Bug 663253: Remove the 'browser.offline' preference (don't remember offline mode from the previous session). r=gavin
authorSteffen Wilberg <steffen.wilberg@web.de>
Tue, 21 Jun 2011 22:23:26 +0200
changeset 71768 e3797dc14be14b650749baf521ec9907ea7f044a
parent 71767 77dec35e81b0d207dab682e660088f81cb4de41f
child 71769 b5b91d2abc561b1d534750c8d22009fb2c32709d
push id209
push userbzbarsky@mozilla.com
push dateTue, 05 Jul 2011 17:42:16 +0000
treeherdermozilla-aurora@cc6e30cce8af [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgavin
bugs663253
milestone7.0a1
Bug 663253: Remove the 'browser.offline' preference (don't remember offline mode from the previous session). r=gavin
browser/base/content/browser.js
browser/components/nsBrowserGlue.js
toolkit/mozapps/extensions/test/xpinstall/browser_offline.js
toolkit/system/dbus/nsDBusService.h
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -5914,20 +5914,16 @@ var BrowserOffline = {
     }
 
     if (!ioService.offline && !this._canGoOffline()) {
       this._updateOfflineUI(false);
       return;
     }
 
     ioService.offline = !ioService.offline;
-
-    // Save the current state for later use as the initial state
-    // (if there is no netLinkService)
-    gPrefService.setBoolPref("browser.offline", ioService.offline);
   },
 
   /////////////////////////////////////////////////////////////////////////////
   // nsIObserver
   observe: function (aSubject, aTopic, aState)
   {
     if (aTopic != "network:offline-status-changed")
       return;
--- a/browser/components/nsBrowserGlue.js
+++ b/browser/components/nsBrowserGlue.js
@@ -345,29 +345,16 @@ BrowserGlue.prototype = {
 
     // apply distribution customizations
     // prefs are applied in _onAppDefaults()
     this._distributionCustomizer.applyCustomizations();
 
     // handle any UI migration
     this._migrateUI();
 
-    // if ioService is managing the offline status, then ioservice.offline
-    // is already set correctly. We will continue to allow the ioService
-    // to manage its offline state until the user uses the "Work Offline" UI.
-    if (!Services.io.manageOfflineStatus) {
-      // set the initial state
-      try {
-        Services.io.offline = Services.prefs.getBoolPref("browser.offline");
-      }
-      catch (e) {
-        Services.io.offline = false;
-      }
-    }
-
     Services.obs.notifyObservers(null, "browser-ui-startup-complete", "");
   },
 
   // the first browser window has finished initializing
   _onFirstWindowLoaded: function BG__onFirstWindowLoaded() {
 #ifdef XP_WIN
     // For windows seven, initialize the jump list module.
     const WINTASKBAR_CONTRACTID = "@mozilla.org/windows-taskbar;1";
--- a/toolkit/mozapps/extensions/test/xpinstall/browser_offline.js
+++ b/toolkit/mozapps/extensions/test/xpinstall/browser_offline.js
@@ -13,17 +13,16 @@ function test() {
   }));
   gBrowser.selectedTab = gBrowser.addTab();
   gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
 }
 
 function download_progress(addon, value, maxValue) {
   try {
     Services.io.manageOfflineStatus = false;
-    Services.prefs.setBoolPref("browser.offline", true);
     Services.io.offline = true;
   } catch (ex) {
   }
 }
 
 function finish_test(count) {
   function wait_for_online() {
     info("Checking if the browser is still offline...");
@@ -32,17 +31,16 @@ function finish_test(count) {
     request.open("GET", TESTROOT + "empty.xpi", true);
     request.onerror = wait_for_online;
     request.onload = Harness.finish;
     request.send(null);
   }
 
   is(count, 0, "No add-ons should have been installed");
   try {
-    Services.prefs.setBoolPref("browser.offline", false);
     Services.io.offline = false;
   } catch (ex) {
   }
 
   Services.perms.remove("example.com", "install");
 
   gBrowser.removeCurrentTab();
   wait_for_online();
--- a/toolkit/system/dbus/nsDBusService.h
+++ b/toolkit/system/dbus/nsDBusService.h
@@ -62,20 +62,17 @@ public:
  * The nsDBusService component interfaces with DBUS to communicate with daemons
  * in systems supporting DBUS. It links dynamically to the DBUS libraries so
  * will not load on systems without those libraries ... but that's harmless.
  *
  * Currently the only daemon we communicate with is NetworkManager. We listen
  * for NetworkManager state changes; we set nsIOService's offline status to
  * FALSE when NetworkManager reports NM_STATE_CONNECTED, and to TRUE otherwise.
  * We also solicit the current status from NetworkManager when this component
- * gets loaded. In addition to setting IOService, we also set the
- * "browser.offline" preference (because Firefox treats that preference as
- * authoritative). We have to wait until prefs have been loaded before setting
- * "browser.offline".
+ * gets loaded.
  * 
  * In the future we could extend this class to talk to other daemons.
  * 
  * Currently all communication is asynchronous. This isn't hard to implement
  * and avoids blocking our main thread.
  */
 class nsDBusService : public nsISupports
 {