diff --git a/content/base/src/ImportManager.cpp b/content/base/src/ImportManager.cpp index 5168db8a1795..1150f03fd0c3 100644 --- a/content/base/src/ImportManager.cpp +++ b/content/base/src/ImportManager.cpp @@ -24,15 +24,16 @@ class AutoError { public: - AutoError(mozilla::dom::ImportLoader* loader) + AutoError(mozilla::dom::ImportLoader* loader, bool scriptsBlocked = true) : mLoader(loader) , mPassed(false) + , mScriptsBlocked(scriptsBlocked) {} ~AutoError() { if (!mPassed) { - mLoader->Error(); + mLoader->Error(mScriptsBlocked); } } @@ -41,6 +42,7 @@ public: private: mozilla::dom::ImportLoader* mLoader; bool mPassed; + bool mScriptsBlocked; }; namespace mozilla { @@ -164,7 +166,7 @@ ImportLoader::Done() } void -ImportLoader::Error() +ImportLoader::Error(bool aUnblockScripts) { mDocument = nullptr; mStopped = true; @@ -172,7 +174,10 @@ ImportLoader::Error() for (uint32_t i = 0; i < count; i++) { DispatchErrorEvent(mLinks[i]); } - UnblockScripts(); + if (aUnblockScripts) { + UnblockScripts(); + } + ReleaseResources(); } @@ -188,7 +193,7 @@ void ImportLoader::ReleaseResources() void ImportLoader::Open() { - AutoError ae(this); + AutoError ae(this, false); // Imports should obey to the master documents CSP. nsCOMPtr master = mImportParent->MasterDocument(); nsCOMPtr sop = do_QueryInterface(master); diff --git a/content/base/src/ImportManager.h b/content/base/src/ImportManager.h index 443068bc2081..d87a9f3bb174 100644 --- a/content/base/src/ImportManager.h +++ b/content/base/src/ImportManager.h @@ -100,7 +100,7 @@ private: void DispatchLoadEvent(nsINode* aNode); // Must be called when an error has occured during load. - void Error(); + void Error(bool aUnblockScripts); // Must be called when the import document has been loaded successfully. void Done();