Bug 573259 - Intermittent time out in browser_relative.js due to browser_offline.js
authorMarco Bonardo <mbonardo@mozilla.com>
Tue, 03 Apr 2012 11:48:36 +0200
changeset 94214 8d741cb2569a3309dea63e2f2ffc952a7332824a
parent 94213 7857c5bff0171c41a2242442aa1bcd232ee87cdf
child 94215 8f85a5488ffb5801e19b8d03123b9558c8865b37
push id886
push userlsblakk@mozilla.com
push dateMon, 04 Jun 2012 19:57:52 +0000
treeherdermozilla-beta@bbd8d5efd6d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs573259
milestone14.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 573259 - Intermittent time out in browser_relative.js due to browser_offline.js r=Mossop
toolkit/mozapps/extensions/test/xpinstall/browser_offline.js
--- a/toolkit/mozapps/extensions/test/xpinstall/browser_offline.js
+++ b/toolkit/mozapps/extensions/test/xpinstall/browser_offline.js
@@ -21,27 +21,34 @@ function download_progress(addon, value,
     Services.io.offline = true;
   } catch (ex) {
   }
 }
 
 function finish_test(count) {
   function wait_for_online() {
     info("Checking if the browser is still offline...");
-    var request = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].
-                  createInstance(Ci.nsIXMLHttpRequest);
-    request.open("GET", TESTROOT + "empty.xpi", true);
-    request.onerror = wait_for_online;
-    request.onload = Harness.finish;
-    request.send(null);
+
+    let tab = gBrowser.selectedTab;
+    tab.linkedBrowser.addEventListener("DOMContentLoaded", function errorLoad() {
+      tab.linkedBrowser.removeEventListener("DOMContentLoaded", errorLoad, true);
+      let url = tab.linkedBrowser.contentDocument.documentURI;
+      info("loaded: " + url);
+      if (/^about:neterror\?e=netOffline/.test(url)) {
+        wait_for_online();
+      } else {
+        gBrowser.removeCurrentTab();
+        Harness.finish();
+      }
+    }, true);
+    tab.linkedBrowser.loadURI("http://example.com/");
   }
 
   is(count, 0, "No add-ons should have been installed");
   try {
     Services.io.offline = false;
   } catch (ex) {
   }
 
   Services.perms.remove("example.com", "install");
 
-  gBrowser.removeCurrentTab();
   wait_for_online();
 }