Bug 897253 - Remove support for calling nsISessionStore.init() with a null window; r=ehsan
authorTim Taubert <ttaubert@mozilla.com>
Wed, 24 Jul 2013 09:58:50 +0200
changeset 139774 b661851684160176cf4cf701f45ca6b8fb47922d
parent 139773 ff08148799106414402b71ea87c13c274b2a9489
child 139775 0a2cc86d61b79c3d7f1708600165d85f0c9b1fdf
push id25003
push userryanvm@gmail.com
push dateWed, 24 Jul 2013 22:20:10 +0000
treeherdermozilla-central@d7f60ad11f48 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs897253
milestone25.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 897253 - Remove support for calling nsISessionStore.init() with a null window; r=ehsan
browser/components/sessionstore/src/SessionStore.jsm
--- a/browser/components/sessionstore/src/SessionStore.jsm
+++ b/browser/components/sessionstore/src/SessionStore.jsm
@@ -561,41 +561,32 @@ let SessionStoreInternal = {
     });
 
     XPCOMUtils.defineLazyGetter(this, "_max_windows_undo", function () {
       this._prefBranch.addObserver("sessionstore.max_windows_undo", this, true);
       return this._prefBranch.getIntPref("sessionstore.max_windows_undo");
     });
   },
 
-  _initWindow: function ssi_initWindow(aWindow) {
-    if (aWindow) {
-      this.onLoad(aWindow);
-    } else if (this._loadState == STATE_STOPPED) {
-      // 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.
-      this._loadState = STATE_RUNNING;
-    }
-  },
-
   /**
    * Start tracking a window.
    *
    * This function also initializes the component if it is not
    * initialized yet.
    */
   init: function ssi_init(aWindow) {
+    if (!aWindow) {
+      throw new Error("init() must be called with a valid window.");
+    }
+
     let self = this;
     this.initService();
     this._promiseInitialization.promise.then(
       function onSuccess() {
-        self._initWindow(aWindow);
+        self.onLoad(aWindow);
       }
     );
   },
 
   /**
    * Called on application shutdown, after notifications:
    * quit-application-granted, quit-application
    */