Bug 603272 - starting private browsing from the taskbar button in Win7 doesn't launch Minefield; r=zpao a=gavin
authorEhsan Akhgari <ehsan@mozilla.com>
Thu, 04 Nov 2010 16:21:33 -0400
changeset 58256 f6ac6dfa96881dfc819378467952e40d91619519
parent 58255 114966e5b16843a42d0957df90dbaac63e735e0b
child 58257 13f5b057c586449e954c5f3e34aae46173dac0bc
push id1
push usershaver@mozilla.com
push dateTue, 04 Jan 2011 17:58:04 +0000
reviewerszpao, gavin
bugs603272
milestone2.0b8pre
Bug 603272 - starting private browsing from the taskbar button in Win7 doesn't launch Minefield; r=zpao a=gavin
browser/components/sessionstore/src/nsSessionStore.js
--- a/browser/components/sessionstore/src/nsSessionStore.js
+++ b/browser/components/sessionstore/src/nsSessionStore.js
@@ -362,39 +362,39 @@ SessionStoreService.prototype = {
         this._prefBranch.getBoolPref("sessionstore.resume_session_once"))
       this._prefBranch.setBoolPref("sessionstore.resume_session_once", false);
 
     this._initialized = true;
   },
 
   /**
    * Start tracking a window.
-   * Important note: despite its name, this function doesn't initialize
-   * the component!
+   * This function also initializes the component if it's not already
+   * initialized.
    */
   init: function sss_init(aWindow) {
+    // Initialize the service if needed.
+    if (!this._initialized)
+      this.initService();
+
     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);
       // If init is being called with a null window, it's possible that we
       // just want to tell sessionstore that a session is live (as is the case
       // with starting Firefox with -private, for example; see bug 568816),
       // so we should mark the load state as running to make sure that
       // things like setBrowserState calls will succeed in restoring the session.
       if (!aWindow && this._loadState == STATE_STOPPED)
         this._loadState = STATE_RUNNING;
       return;
     }
 
-    // Initialize the service if needed.
-    if (!this._initialized)
-      this.initService();
-
     // As this is called at delayedStartup, restoration must be initiated here
     this.onLoad(aWindow);
   },
 
   /**
    * Called on application shutdown, after notifications:
    * quit-application-granted, quit-application
    */