Bug 1446568: Make nsIDocument SetContentType / SetDocumentCharacterSet not pure virtual. r=smaug
No good reason for them to be.
MozReview-Commit-ID: 7bFVD8YFqo2
--- 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);
}