Bug 1441971 - Restart aborted script load for waiting XULDocument loads; r=bz
authorJim Chen <nchen@mozilla.com>
Wed, 28 Feb 2018 14:46:06 -0500
changeset 411437 c3b12adc84b141d795fc1c86d9c0754c3b4e4241
parent 411436 5c9c6f5a4ca35835b9614a8cdb3eefda44cb585d
child 411438 fc4a2fff3c89b8691a81a8c101ca94251115f000
push id101651
push useraiakab@mozilla.com
push dateTue, 03 Apr 2018 09:42:02 +0000
treeherdermozilla-inbound@99a953f1823f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs1441971
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1441971 - Restart aborted script load for waiting XULDocument loads; r=bz 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
dom/xul/XULDocument.cpp
--- a/dom/xul/XULDocument.cpp
+++ b/dom/xul/XULDocument.cpp
@@ -3214,16 +3214,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);
     }