Bug 1441971 - Restart aborted script load for waiting XULDocument loads; r?janv
When a particular XULDocument load is aborted, its pending script loads
are aborted as well. However, there may be additional XULDocuments
waiting for the same scripts to load. If we continue with the abort, all
the waiting docs will end up with aborted script loads as well.
This patch makes us load the script again for the waiting docs, so that
one aborted doc load does not affect other docs that just happen to be
waiting on the same scripts to load.
MozReview-Commit-ID: FFGBjOLXCDt
--- a/dom/xul/XULDocument.cpp
+++ b/dom/xul/XULDocument.cpp
@@ -3148,16 +3148,26 @@ XULDocument::OnScriptCompileComplete(JSS
NS_ASSERTION(doc->mCurrentScriptProto == scriptProto,
"waiting for wrong script to load?");
doc->mCurrentScriptProto = nullptr;
// Unlink doc from scriptProto's list before executing and resuming
*docp = doc->mNextSrcLoadWaiter;
doc->mNextSrcLoadWaiter = nullptr;
+ if (aStatus == NS_BINDING_ABORTED && !scriptProto->HasScriptObject()) {
+ // If the previous doc load was aborted, we want to try loading
+ // again for the next doc. Otherwise, one abort would lead to all
+ // subsequent waiting docs to abort as well.
+ bool block = false;
+ doc->LoadScript(scriptProto, &block);
+ NS_RELEASE(doc);
+ return rv;
+ }
+
// Execute only if we loaded and compiled successfully, then resume
if (NS_SUCCEEDED(aStatus) && scriptProto->HasScriptObject()) {
doc->ExecuteScript(scriptProto);
}
doc->ResumeWalk();
NS_RELEASE(doc);
}