Bug 874028 - Debugger and Net monitor tests should use browser's load event rather than tab's, r=past
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Mon, 20 May 2013 15:23:06 +0200
changeset 139523 108c6b3bf66e7018a1fcbbf78981eca801fe76f7
parent 139522 0c312bf9446a310f5f6080a214ba12e9589b862b
child 139524 8ab9e35fd41f1235ac5730743c093426e4f4ce8b
push id3911
push userakeybl@mozilla.com
push dateMon, 24 Jun 2013 20:17:26 +0000
treeherdermozilla-aurora@7e26ca8db92b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspast
bugs874028
milestone24.0a1
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
browser/devtools/netmonitor/test/head.js
--- a/browser/devtools/debugger/test/head.js
+++ b/browser/devtools/debugger/test/head.js
@@ -65,29 +65,30 @@ function addWindow() {
 function addTab(aURL, aOnload, aWindow) {
   let targetWindow = aWindow || window;
   let targetBrowser = targetWindow.gBrowser;
 
   targetWindow.focus();
   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;
 }
 
 function removeTab(aTab, aWindow) {
   let targetWindow = aWindow || window;
   let targetBrowser = targetWindow.gBrowser;
--- a/browser/devtools/netmonitor/test/head.js
+++ b/browser/devtools/netmonitor/test/head.js
@@ -47,19 +47,20 @@ function addTab(aUrl, aWindow) {
   info("Adding tab: " + aUrl);
 
   let deferred = Promise.defer();
   let targetWindow = aWindow || window;
   let targetBrowser = targetWindow.gBrowser;
 
   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);
 
   return deferred.promise;
 }
 
 function removeTab(aTab, aWindow) {
   info("Removing tab.");