Bug 449596 - "remove the browser.sessionstore.enabled pref" (remove the pref) [r=dietrich]
authorSimon Bünzli <zeniko@gmail.com>
Wed, 20 Aug 2008 00:48:08 -0500
changeset 17120 e712e96d7861fd96a582e1f0999233b556a298be
parent 17119 7f3879f421514a52a7961074f337853d65df2ce3
child 17121 adb1ef78dd21c36f215e80ab1423b68ec62a7522
push idunknown
push userunknown
push dateunknown
reviewersdietrich
bugs449596
milestone1.9.1a2pre
Bug 449596 - "remove the browser.sessionstore.enabled pref" (remove the pref) [r=dietrich]
browser/app/profile/firefox.js
browser/base/content/tabbrowser.xml
browser/components/sessionstore/src/nsSessionStartup.js
browser/components/sessionstore/src/nsSessionStore.js
testing/tools/profiles/createTestingProfile.py
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -675,17 +675,16 @@ pref("browser.EULA.3.accepted", false);
 
 // if we rev the EULA again, we should bump this so users agree to the new EULA
 pref("browser.EULA.version", 3);
 
 #ifdef DEBUG
 pref("browser.EULA.override", true);
 #endif
 
-pref("browser.sessionstore.enabled", true);
 pref("browser.sessionstore.resume_from_crash", true);
 pref("browser.sessionstore.resume_session_once", false);
 
 // minimal interval between two save operations in milliseconds
 pref("browser.sessionstore.interval", 10000);
 // maximum amount of POSTDATA to be saved in bytes per history entry (-1 = all of it)
 // (NB: POSTDATA will be saved either entirely or not at all)
 pref("browser.sessionstore.postdata", 0);
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -674,24 +674,22 @@
           <![CDATA[
             this.mContextTab = document.popupNode;
             var disabled = this.mPanelContainer.childNodes.length == 1;
             var menuItems = aPopupMenu.getElementsByAttribute("tbattr", "tabbrowser-multiple");
             for (var i = 0; i < menuItems.length; i++)
               menuItems[i].disabled = disabled;
 
             // Session store
-            if (gPrefService.getBoolPref("browser.sessionstore.enabled")) {
-              this.mUndoCloseTabMenuItem.hidden =
-                Cc["@mozilla.org/browser/sessionstore;1"].
-                getService(Ci.nsISessionStore).
-                getClosedTabCount(window) == 0;
-            }
-            else
-              this.mUndoCloseTabMenuItem.hidden = true;
+            // XXXzeniko should't we just disable this item as we disable
+            // the tabbrowser-multiple items above - for consistency?
+            this.mUndoCloseTabMenuItem.hidden =
+              Cc["@mozilla.org/browser/sessionstore;1"].
+              getService(Ci.nsISessionStore).
+              getClosedTabCount(window) == 0;
           ]]>
         </body>
       </method>
 
       <method name="updateCurrentBrowser">
         <body>
           <![CDATA[
             var newBrowser = this.getBrowserAtIndex(this.mTabContainer.selectedIndex);
--- a/browser/components/sessionstore/src/nsSessionStartup.js
+++ b/browser/components/sessionstore/src/nsSessionStartup.js
@@ -93,20 +93,16 @@ SessionStartup.prototype = {
 
   /**
    * Initialize the component
    */
   init: function sss_init() {
     this._prefBranch = Cc["@mozilla.org/preferences-service;1"].
                        getService(Ci.nsIPrefService).getBranch("browser.");
 
-    // if the service is disabled, do not init 
-    if (!this._prefBranch.getBoolPref("sessionstore.enabled"))
-      return;
-
     // get file references
     var dirService = Cc["@mozilla.org/file/directory_service;1"].
                      getService(Ci.nsIProperties);
     this._sessionFile = dirService.get("ProfD", Ci.nsILocalFile);
     this._sessionFile.append("sessionstore.js");
     
     // only read the session file if config allows possibility of restoring
     var resumeFromCrash = this._prefBranch.getBoolPref("sessionstore.resume_from_crash");
--- a/browser/components/sessionstore/src/nsSessionStore.js
+++ b/browser/components/sessionstore/src/nsSessionStore.js
@@ -52,17 +52,16 @@
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 const Cr = Components.results;
 const Cu = Components.utils;
 
 const STATE_STOPPED = 0;
 const STATE_RUNNING = 1;
 const STATE_QUITTING = -1;
-const STATE_DISABLED = -2;
 
 const STATE_STOPPED_STR = "stopped";
 const STATE_RUNNING_STR = "running";
 
 const PRIVACY_NONE = 0;
 const PRIVACY_ENCRYPTED = 1;
 const PRIVACY_FULL = 2;
 
@@ -154,43 +153,31 @@ SessionStoreService.prototype = {
   _dirty: false,
 
 /* ........ Global Event Handlers .............. */
 
   /**
    * Initialize the component
    */
   init: function sss_init(aWindow) {
-    if (this._loadState == STATE_DISABLED)
-      return;
-
     if (!aWindow || this._loadState == STATE_RUNNING) {
       // make sure that all browser windows which try to initialize
       // SessionStore are really tracked by it
       if (aWindow && (!aWindow.__SSi || !this._windows[aWindow.__SSi]))
         this.onLoad(aWindow);
       return;
     }
 
     this._prefBranch = Cc["@mozilla.org/preferences-service;1"].
                        getService(Ci.nsIPrefService).getBranch("browser.");
     this._prefBranch.QueryInterface(Ci.nsIPrefBranch2);
 
     var observerService = Cc["@mozilla.org/observer-service;1"].
                           getService(Ci.nsIObserverService);
 
-    // if the service is disabled, do not init 
-    if (!this._prefBranch.getBoolPref("sessionstore.enabled")) {
-      // Notify observers that the sessionstore has done everything it is going to.
-      observerService.notifyObservers(null, NOTIFY_WINDOWS_RESTORED, "");
-      // Mark as disabled so we don't even try to initialise again.
-      this._loadState = STATE_DISABLED;
-      return;
-    }
-
     OBSERVING.forEach(function(aTopic) {
       observerService.addObserver(this, aTopic, true);
     }, this);
     
     // get interval from prefs - used often, so caching/observing instead of fetching on-demand
     this._interval = this._prefBranch.getIntPref("sessionstore.interval");
     this._prefBranch.addObserver("sessionstore.interval", this, true);
     
--- a/testing/tools/profiles/createTestingProfile.py
+++ b/testing/tools/profiles/createTestingProfile.py
@@ -7,29 +7,28 @@ import sys
 
 # If you are adding prefs that require string values (rather than true/false),
 # be sure to wrap the string value in quotes, e.g.:
 # 'browser.active_color': '"#EE0000"',
 userPrefs = {
     'browser.chrome.favicons': 'false',
     'browser.chrome.site_icons': 'false',
     'browser.dom.window.dump.enabled': 'true',
-    'browser.sessionstore.enabled': 'false',
     'browser.sessionstore.resume_from_crash': 'false',
     'browser.shell.checkDefaultBrowser': 'false',
     'browser.tabs.warnOnClose': 'false',
     'browser.warnOnQuit': 'false',
     'dom.allow_scripts_to_close_windows': 'true',
     'dom.disable_open_during_load': 'false',
     'dom.disable_window_flip': 'false',
     'dom.disable_window_move_resize': 'false',
     'layout.fire_onload_after_image_background_loads': 'true',
     'javascript.options.showInConsole': 'true',
     'privacy.popups.firstTime': 'false',
-    'layout.debug.enable_data_xbl': 'true',
+    'layout.debug.enable_data_xbl': 'true',
     'browser.EULA.override': 'true'
 }
 
 def usage():
     print "python " + sys.argv[0] + " --binary=binary_location [--profileName=default] [--clobber] [--help]" 
 
 def runCreateProfile(binary,profileName):
     cmd = binary + " -CreateProfile " + profileName
@@ -61,34 +60,34 @@ def main(argv):
     try:
         opts, args = getopt.getopt(argv, 
                                    "hb:p:cd", 
                                    ["help", 
                                     "binary=", 
                                     "profileName=",
                                     "clobber"])
     except getopt.GetoptError:
-	usage()
+        usage()
         sys.exit(2)
 
     binary = ""
     profileName = "default"
     clobber=0
     for o,a in opts:
         if o in ("-h", "--help"):
             usage()
             sys.exit()
         if o in ("-b","--binary"):
             binary=a
         if o in ("-p","--profileName"):
             profileName=a
         if o in ("-c","--clobber"):
             clobber=1
     if binary=="" or not os.path.exists(binary):
-	usage()
+        usage()
         sys.exit(2)
 
     profileLocation = runCreateProfile(binary,profileName)
     if not profileLocation or not os.path.exists(profileLocation):
         print "Couldn't find profile location"
         sys.exit(2)
     # Delete the existing profile directory if clobber is requested.
     # -CreateProfile will re-create it in the right place.
@@ -99,9 +98,8 @@ def main(argv):
         if not profileLocation or not os.path.exists(profileLocation):
             print "Couldn't find profile location on second pass"
             sys.exit(2)
 
     populatePrefs(profileLocation)
 
 if __name__ == "__main__":
     main(sys.argv[1:])
-