Bug 806205 - browser_bug435325.js test fails, r=IanN
authorFrank Wein <mcsmurf@mcsmurf.de>
Mon, 29 Oct 2012 21:17:30 +0100
changeset 11409 892a9063f5aad9d47005127ed1a31a597c65dca1
parent 11408 852d3e76c665f5a249a590ec4b5d07cc582818ac
child 11410 eb96bc7dafc096f814f89b5c78c2021e8efe596b
push id8529
push usermcsmurf@mcsmurf.de
push dateMon, 29 Oct 2012 20:19:35 +0000
treeherdercomm-central@892a9063f5aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersIanN
bugs806205, 435325
Bug 806205 - browser_bug435325.js test fails, r=IanN
suite/browser/test/browser/browser_bug435325.js
--- a/suite/browser/test/browser/browser_bug435325.js
+++ b/suite/browser/test/browser/browser_bug435325.js
@@ -1,20 +1,28 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 /* Ensure that clicking the button in the Offline mode neterror page makes the browser go online. See bug 435325. */
 
+var proxyPrefValue;
+
 function test() {
   waitForExplicitFinish();
 
   gBrowser.selectedTab = gBrowser.addTab();
   window.addEventListener("DOMContentLoaded", checkPage, false);
 
-  // Go offline and disable the cache, then try to load the test URL.
+
+  // Tests always connect to localhost, and per bug 87717, localhost is now
+  // reachable in offline mode.  To avoid this, disable any proxy.
+  proxyPrefValue = Services.prefs.getIntPref("network.proxy.type");
+  Services.prefs.setIntPref("network.proxy.type", 0);
+
+  // Go offline and disable the proxy and cache, then try to load the test URL.
   Services.io.offline = true;
   Services.prefs.setBoolPref("browser.cache.disk.enable", false);
   Services.prefs.setBoolPref("browser.cache.memory.enable", false);
   content.location = "http://example.com/";
 }
 
 function checkPage() {
   if(content.location == "about:blank") {
@@ -35,13 +43,14 @@ function checkPage() {
 
   ok(!Services.io.offline, "After clicking the Try Again button, we're back " +
                            "online.");
 
   finish();
 }
 
 registerCleanupFunction(function() {
+  Services.prefs.setIntPref("network.proxy.type", proxyPrefValue);
   Services.prefs.setBoolPref("browser.cache.disk.enable", true);
   Services.prefs.setBoolPref("browser.cache.memory.enable", true);
   Services.io.offline = false;
   gBrowser.removeCurrentTab();
 });