Bug 1066394 - fix intermittent load events in browser_967000_button_sync.js, r=markh
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Fri, 12 Sep 2014 11:42:14 +0100
changeset 205148 9f4de6f4b71b83fc354f4342199ba98e88bffb07
parent 205147 3b16c8fd53e89a9c1341931049c571898c438467
child 205149 0a03eb20fac5ecec9a00419f6f340d16d889e86f
push id49106
push userphilringnalda@gmail.com
push dateSat, 13 Sep 2014 17:12:34 +0000
treeherdermozilla-inbound@ab04d0f2665f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmarkh
bugs1066394
milestone35.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 1066394 - fix intermittent load events in browser_967000_button_sync.js, r=markh
browser/components/customizableui/test/browser_967000_button_sync.js
--- a/browser/components/customizableui/test/browser_967000_button_sync.js
+++ b/browser/components/customizableui/test/browser_967000_button_sync.js
@@ -25,21 +25,26 @@ function openAboutAccountsFromMenuPanel(
     UITour.originTabs.set(window, new Set());
     UITour.originTabs.get(window).add(gBrowser.selectedTab);
   }
 
   let syncButton = document.getElementById("sync-button");
   ok(syncButton, "The Sync button was added to the Panel Menu");
 
   let deferred = Promise.defer();
-  let handler = () => {
-    gBrowser.selectedTab.removeEventListener("load", handler, true);
+  let handler = (e) => {
+    if (e.originalTarget != gBrowser.selectedTab.linkedBrowser.contentDocument ||
+        e.target.location.href == "about:blank") {
+      info("Skipping spurious 'load' event for " + e.target.location.href);
+      return;
+    }
+    gBrowser.selectedTab.linkedBrowser.removeEventListener("load", handler, true);
     deferred.resolve();
   }
-  gBrowser.selectedTab.addEventListener("load", handler, true);
+  gBrowser.selectedTab.linkedBrowser.addEventListener("load", handler, true);
 
   syncButton.click();
   yield deferred.promise;
   newTab = gBrowser.selectedTab;
 
   is(gBrowser.currentURI.spec, "about:accounts?entrypoint=" + entryPoint,
     "Firefox Sync page opened with `menupanel` entrypoint");
   ok(!isPanelUIOpen(), "The panel closed");