From 488e1354a5704d577738a9317cf69c3e69710dd4 Mon Sep 17 00:00:00 2001 From: Gijs Kruitbosch Date: Mon, 20 May 2013 15:23:06 +0200 Subject: [PATCH] Bug 874028 - Debugger and Net monitor tests should use browser's load event rather than tab's, r=past --- browser/devtools/debugger/test/head.js | 9 +++++---- browser/devtools/netmonitor/test/head.js | 5 +++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/browser/devtools/debugger/test/head.js b/browser/devtools/debugger/test/head.js index 8093acc03b0..f5a3c8f94b4 100644 --- a/browser/devtools/debugger/test/head.js +++ b/browser/devtools/debugger/test/head.js @@ -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; diff --git a/browser/devtools/netmonitor/test/head.js b/browser/devtools/netmonitor/test/head.js index 8fbff1e524b..a7333e06f96 100644 --- a/browser/devtools/netmonitor/test/head.js +++ b/browser/devtools/netmonitor/test/head.js @@ -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);