Bug 1446568: Make nsIDocument SetContentType / SetDocumentCharacterSet not pure virtual. r=smaug draft
authorEmilio Cobos Álvarez <emilio@crisal.io>
Thu, 15 Mar 2018 18:34:50 +0100
changeset 768880 f389c2a63993315c7957cc9a77beecc10c231c3c
parent 768879 56273dc25c99b8a0a2224d5f1765a4b187eb502f
child 768881 8370ff3b312f1968b1a61f9a60a81796ed9fb600
push id102997
push userbmo:emilio@crisal.io
push dateSat, 17 Mar 2018 00:00:09 +0000
reviewerssmaug
bugs1446568
milestone61.0a1
Bug 1446568: Make nsIDocument SetContentType / SetDocumentCharacterSet not pure virtual. r=smaug No good reason for them to be. MozReview-Commit-ID: 7bFVD8YFqo2
dom/base/nsDocument.cpp
dom/base/nsDocument.h
dom/base/nsIDocument.h
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -3358,17 +3358,17 @@ nsDocument::SetApplicationCache(nsIAppli
 
 void
 nsIDocument::GetContentType(nsAString& aContentType)
 {
   CopyUTF8toUTF16(GetContentTypeInternal(), aContentType);
 }
 
 void
-nsDocument::SetContentType(const nsAString& aContentType)
+nsIDocument::SetContentType(const nsAString& aContentType)
 {
   SetContentTypeInternal(NS_ConvertUTF16toUTF8(aContentType));
 }
 
 bool
 nsIDocument::GetAllowPlugins()
 {
   // First, we ask our docshell if it allows plugins.
@@ -3741,17 +3741,17 @@ nsIDocument::DefaultStyleAttrURLData()
   return mCachedURLData;
 #else
   MOZ_CRASH("Should not be called for non-stylo build");
   return nullptr;
 #endif
 }
 
 void
-nsDocument::SetDocumentCharacterSet(NotNull<const Encoding*> aEncoding)
+nsIDocument::SetDocumentCharacterSet(NotNull<const Encoding*> aEncoding)
 {
   if (mCharacterSet != aEncoding) {
     mCharacterSet = aEncoding;
 
     if (nsPresContext* context = GetPresContext()) {
       context->DispatchCharSetChange(aEncoding);
     }
   }
--- a/dom/base/nsDocument.h
+++ b/dom/base/nsDocument.h
@@ -157,28 +157,16 @@ public:
                                      nsILoadGroup* aLoadGroup,
                                      nsISupports* aContainer,
                                      nsIStreamListener **aDocListener,
                                      bool aReset = true,
                                      nsIContentSink* aContentSink = nullptr) override = 0;
 
   virtual void StopDocumentLoad() override;
 
-  /**
-   * Set the Content-Type of this document.
-   */
-  virtual void SetContentType(const nsAString& aContentType) override;
-
-  /**
-   * Set the document's character encoding. This will
-   * trigger a startDocumentLoad if necessary to answer the question.
-   */
-  virtual void
-    SetDocumentCharacterSet(NotNull<const Encoding*> aEncoding) override;
-
   static bool CallerIsTrustedAboutPage(JSContext* aCx, JSObject* aObject);
   static bool IsElementAnimateEnabled(JSContext* aCx, JSObject* aObject);
   static bool IsWebAnimationsEnabled(JSContext* aCx, JSObject* aObject);
   static bool IsWebAnimationsEnabled(mozilla::dom::CallerType aCallerType);
 
   virtual nsIChannel* GetFailedChannel() const override {
     return mFailedChannel;
   }
--- a/dom/base/nsIDocument.h
+++ b/dom/base/nsIDocument.h
@@ -782,19 +782,20 @@ public:
    * Return a standard name for the document's character set.
    */
   NotNull<const Encoding*> GetDocumentCharacterSet() const
   {
     return mCharacterSet;
   }
 
   /**
-   * Set the document's character encoding.
+   * Set the document's character encoding. This will
+   * trigger a startDocumentLoad if necessary to answer the question.
    */
-  virtual void SetDocumentCharacterSet(NotNull<const Encoding*> aEncoding) = 0;
+  virtual void SetDocumentCharacterSet(NotNull<const Encoding*> aEncoding);
 
   int32_t GetDocumentCharacterSetSource() const
   {
     return mCharacterSetSource;
   }
 
   // This method MUST be called before SetDocumentCharacterSet if
   // you're planning to call both.
@@ -853,17 +854,17 @@ public:
   /**
    * Get the Content-Type of this document.
    */
   void GetContentType(nsAString& aContentType);
 
   /**
    * Set the Content-Type of this document.
    */
-  virtual void SetContentType(const nsAString& aContentType) = 0;
+  virtual void SetContentType(const nsAString& aContentType);
 
   /**
    * Return the language of this document.
    */
   void GetContentLanguage(nsAString& aContentLanguage) const
   {
     CopyASCIItoUTF16(mContentLanguage, aContentLanguage);
   }