Bug 500702 - intermittent failure in browser_bug495058.js
authorDão Gottwald <dao@mozilla.com>
Thu, 13 Aug 2009 09:51:05 +0200
changeset 31421 908834ee9c289a1a2f8151b0132598310bc5b6ce
parent 31419 63fbf79e947461937a9c87a0969ac60687fe1ea7
child 31422 3511005c7340c18675b155cc5557e5f00d1e6073
push id1
push usersledru@mozilla.com
push dateThu, 04 Dec 2014 17:57:20 +0000
bugs500702, 495058
milestone1.9.2a2pre
Bug 500702 - intermittent failure in browser_bug495058.js
browser/base/content/test/browser_bug495058.js
--- a/browser/base/content/test/browser_bug495058.js
+++ b/browser/base/content/test/browser_bug495058.js
@@ -24,29 +24,28 @@ function next() {
     browser.loadURI(uri);
   }
 
   function detach() {
     var win = gBrowser.replaceTabWithWindow(tab);
     win.addEventListener("load", function () {
       win.removeEventListener("load", arguments.callee, false);
 
-      win.gBrowser.addEventListener("pageshow", function() {
-        win.gBrowser.removeEventListener("pageshow", arguments.callee, false);
+      var _delayedStartup = win.delayedStartup;
+      win.delayedStartup = function delayedStartup() {
+        _delayedStartup.apply(win, arguments);
+        win.delayedStartup = _delayedStartup;
 
-        // wait for delayedStartup
-        win.setTimeout(function () {
-          is(win.gBrowser.currentURI.spec, uri, uri + ": uri loaded in detached tab");
-          is(win.document.activeElement, win.gBrowser.selectedBrowser, uri + ": browser is focused");
-          is(win.gURLBar.value, "", uri + ": urlbar is empty");
-          ok(win.gURLBar.emptyText, uri + ": emptytext is present");
-          ok(win.gURLBar.hasAttribute("isempty"), uri + ": emptytext is displayed");
+        is(win.gBrowser.currentURI.spec, uri, uri + ": uri loaded in detached tab");
+        is(win.document.activeElement, win.gBrowser.selectedBrowser, uri + ": browser is focused");
+        is(win.gURLBar.value, "", uri + ": urlbar is empty");
+        ok(win.gURLBar.emptyText, uri + ": emptytext is present");
+        ok(win.gURLBar.hasAttribute("isempty"), uri + ": emptytext is displayed");
 
-          win.close();
-          if (uris.length)
-            next();
-          else
-            executeSoon(finish);
-        }, 100);
-      }, false);
+        win.close();
+        if (uris.length)
+          next();
+        else
+          executeSoon(finish);
+      };
     }, false);
   }
 }