Bug 874028 - Debugger and Net monitor tests should use browser's load event rather than tab's, r=past

This commit is contained in:
Gijs Kruitbosch 2013-05-20 15:23:06 +02:00
parent f3952f8e0a
commit 488e1354a5
2 changed files with 8 additions and 6 deletions

View File

@ -70,19 +70,20 @@ function addTab(aURL, aOnload, aWindow) {
targetBrowser.selectedTab = targetBrowser.addTab(aURL);
let tab = targetBrowser.selectedTab;
let win = tab.linkedBrowser.contentWindow;
let browser = tab.linkedBrowser;
let win = browser.contentWindow;
let expectedReadyState = aURL == "about:blank" ? ["interactive", "complete"] : ["complete"];
if (aOnload) {
let handler = function() {
if (tab.linkedBrowser.currentURI.spec != aURL ||
if (browser.currentURI.spec != aURL ||
expectedReadyState.indexOf((win.document || {}).readyState) == -1) {
return;
}
tab.removeEventListener("load", handler, false);
browser.removeEventListener("load", handler, true);
executeSoon(aOnload);
}
tab.addEventListener("load", handler, false);
browser.addEventListener("load", handler, true);
}
return tab;

View File

@ -52,9 +52,10 @@ function addTab(aUrl, aWindow) {
targetWindow.focus();
let tab = targetBrowser.selectedTab = targetBrowser.addTab(aUrl);
let browser = tab.linkedBrowser;
tab.addEventListener("load", function onLoad() {
tab.removeEventListener("load", onLoad, true);
browser.addEventListener("load", function onLoad() {
browser.removeEventListener("load", onLoad, true);
deferred.resolve(tab);
}, true);