Bug 1444580: Devirtualize IsScriptEnabled. r=smaug
MozReview-Commit-ID: FEhddLUXnO4
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -7691,17 +7691,17 @@ nsDocument::GetXMLDeclaration(nsAString&
aStandalone.AssignLiteral("yes");
} else {
aStandalone.AssignLiteral("no");
}
}
}
bool
-nsDocument::IsScriptEnabled()
+nsIDocument::IsScriptEnabled()
{
// If this document is sandboxed without 'allow-scripts'
// script is not enabled
if (HasScriptsBlockedBySandbox()) {
return false;
}
nsCOMPtr<nsIScriptGlobalObject> globalObject = do_QueryInterface(GetInnerWindow());
--- a/dom/base/nsDocument.h
+++ b/dom/base/nsDocument.h
@@ -408,17 +408,16 @@ public:
virtual void FlushExternalResources(mozilla::FlushType aType) override;
virtual void SetXMLDeclaration(const char16_t *aVersion,
const char16_t *aEncoding,
const int32_t aStandalone) override;
virtual void GetXMLDeclaration(nsAString& aVersion,
nsAString& aEncoding,
nsAString& Standalone) override;
- virtual bool IsScriptEnabled() override;
virtual void OnPageShow(bool aPersisted, mozilla::dom::EventTarget* aDispatchStartTarget) override;
virtual void OnPageHide(bool aPersisted, mozilla::dom::EventTarget* aDispatchStartTarget) override;
virtual void WillDispatchMutationEvent(nsINode* aTarget) override;
virtual void MutationEventDispatched(nsINode* aTarget) override;
// nsINode
--- a/dom/base/nsIDocument.h
+++ b/dom/base/nsIDocument.h
@@ -1894,17 +1894,17 @@ public:
{
return IsLoadedAsData() || IsLoadedAsInteractiveData();
}
bool LoadsFullXULStyleSheetUpFront()
{
return IsXULDocument() || AllowXULXBL();
}
- virtual bool IsScriptEnabled() = 0;
+ bool IsScriptEnabled();
bool IsTopLevelContentDocument() const { return mIsTopLevelContentDocument; }
void SetIsTopLevelContentDocument(bool aIsTopLevelContentDocument)
{
mIsTopLevelContentDocument = aIsTopLevelContentDocument;
// When a document is set as TopLevelContentDocument, it must be
// allowpaymentrequest. We handle the false case while a document is appended
// in SetSubDocumentFor