Bug 1507689 - Fix an intermittent failure condition in test_WebExtensionContentScript.js which is turned into a perma-failure with the patch in bug 1504728 r=kmag
authorEhsan Akhgari <ehsan@mozilla.com>
Fri, 16 Nov 2018 21:42:02 +0000
changeset 446881 be52a638d6c5f2ee00e472bc8a08c1605535b60a
parent 446880 b9a2dff8c8f5963bd9384f30036731cd65cd3c8d
child 446882 32e919db3735b2c11d2533706ebce858c73477d3
push id109932
push userapavel@mozilla.com
push dateSat, 17 Nov 2018 11:35:32 +0000
treeherdermozilla-inbound@e4deec61fc8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskmag
bugs1507689, 1504728
milestone65.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 1507689 - Fix an intermittent failure condition in test_WebExtensionContentScript.js which is turned into a perma-failure with the patch in bug 1504728 r=kmag Differential Revision: https://phabricator.services.mozilla.com/D12093
toolkit/components/extensions/test/xpcshell/test_WebExtensionContentScript.js
--- a/toolkit/components/extensions/test/xpcshell/test_WebExtensionContentScript.js
+++ b/toolkit/components/extensions/test/xpcshell/test_WebExtensionContentScript.js
@@ -52,20 +52,22 @@ async function loadURL(url, {frameCount}
 
   function requestObserver(request) {
     request.QueryInterface(Ci.nsIChannel);
     if (request.isDocument) {
       requests.set(request.name, request);
     }
   }
   function loadObserver(window) {
-    windows.set(window.location.href, window);
-    if (windows.size == frameCount) {
-      resolveLoad();
-    }
+    window.addEventListener("load", function onLoad() {
+      windows.set(window.location.href, window);
+      if (windows.size == frameCount) {
+        resolveLoad();
+      }
+    }, {once: true});
   }
 
   Services.obs.addObserver(requestObserver, "http-on-examine-response");
   Services.obs.addObserver(loadObserver, "content-document-global-created");
 
   let webNav = Services.appShell.createWindowlessBrowser(false);
   let systemPrincipal = Services.scriptSecurityManager.getSystemPrincipal();
   webNav.loadURI(url, 0, null, null, null, systemPrincipal);