Bug 1066394 - fix intermittent load events in browser_967000_button_sync.js, r=markh

This commit is contained in:
Gijs Kruitbosch 2014-09-12 11:42:14 +01:00
parent 54e44d4c3b
commit 226bf1e3c6

View File

@ -30,11 +30,16 @@ function openAboutAccountsFromMenuPanel(entryPoint) {
ok(syncButton, "The Sync button was added to the Panel Menu"); ok(syncButton, "The Sync button was added to the Panel Menu");
let deferred = Promise.defer(); let deferred = Promise.defer();
let handler = () => { let handler = (e) => {
gBrowser.selectedTab.removeEventListener("load", handler, true); 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(); deferred.resolve();
} }
gBrowser.selectedTab.addEventListener("load", handler, true); gBrowser.selectedTab.linkedBrowser.addEventListener("load", handler, true);
syncButton.click(); syncButton.click();
yield deferred.promise; yield deferred.promise;