Bug 902550 - Disable more session restore code in e10s (r=ttaubert)
authorBill McCloskey <wmccloskey@mozilla.com>
Wed, 14 Aug 2013 14:33:44 -0700
changeset 142684 eb7bf75e0a28a4b6f65c489886cce2792131abd7
parent 142683 9cf0ecb708f50a1f89678adb889687a9d194ecf6
child 142685 c37719f4d482cf4f62501217b2e3117242903f2c
push id25104
push useremorley@mozilla.com
push dateThu, 15 Aug 2013 10:56:09 +0000
treeherdermozilla-central@31c08ca022b3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersttaubert
bugs902550
milestone26.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 902550 - Disable more session restore code in e10s (r=ttaubert)
browser/components/sessionstore/src/SessionStore.jsm
--- a/browser/components/sessionstore/src/SessionStore.jsm
+++ b/browser/components/sessionstore/src/SessionStore.jsm
@@ -370,24 +370,29 @@ let SessionStoreInternal = {
     if (this._initialized) {
       throw new Error("SessionStore.init() must only be called once!");
     }
 
     if (!aWindow) {
       throw new Error("SessionStore.init() must be called with a valid window.");
     }
 
+    this._disabledForMultiProcess = Services.prefs.getBoolPref("browser.tabs.remote");
+    if (this._disabledForMultiProcess) {
+      this._deferredInitialized.resolve();
+      return;
+    }
+
     TelemetryTimestamps.add("sessionRestoreInitialized");
     OBSERVING.forEach(function(aTopic) {
       Services.obs.addObserver(this, aTopic, true);
     }, this);
 
     this._initPrefs();
     this._initialized = true;
-    this._disabledForMultiProcess = this._prefBranch.getBoolPref("tabs.remote");
 
     // this pref is only read at startup, so no need to observe it
     this._sessionhistory_max_entries =
       this._prefBranch.getIntPref("sessionhistory.max_entries");
 
     // Wait until nsISessionStartup has finished reading the session data.
     gSessionStartup.onceInitialized.then(() => {
       // Parse session data and start restoring.
@@ -562,19 +567,16 @@ let SessionStoreInternal = {
     // Make sure to cancel pending saves.
     SessionSaver.cancel();
   },
 
   /**
    * Handle notifications
    */
   observe: function ssi_observe(aSubject, aTopic, aData) {
-    if (this._disabledForMultiProcess)
-      return;
-
     switch (aTopic) {
       case "domwindowopened": // catch new windows
         this.onOpen(aSubject);
         break;
       case "domwindowclosed": // catch closed windows
         this.onClose(aSubject);
         break;
       case "quit-application-requested":
@@ -1482,25 +1484,31 @@ let SessionStoreInternal = {
 
     this.restoreHistoryPrecursor(aWindow, [newTab], [tabState], 0, 0, 0,
                                  true /* Load this tab right away. */);
 
     return newTab;
   },
 
   setNumberOfTabsClosedLast: function ssi_setNumberOfTabsClosedLast(aWindow, aNumber) {
+    if (this._disabledForMultiProcess)
+      return;
+
     if ("__SSi" in aWindow) {
       return NumberOfTabsClosedLastPerWindow.set(aWindow, aNumber);
     }
 
     throw (Components.returnCode = Cr.NS_ERROR_INVALID_ARG);
   },
 
   /* Used to undo batch tab-close operations. Defaults to 1. */
   getNumberOfTabsClosedLast: function ssi_getNumberOfTabsClosedLast(aWindow) {
+    if (this._disabledForMultiProcess)
+      return 0;
+
     if ("__SSi" in aWindow) {
       // Blank tabs cannot be undo-closed, so the number returned by
       // the NumberOfTabsClosedLastPerWindow can be greater than the
       // return value of getClosedTabCount. We won't restore blank
       // tabs, so we return the minimum of these two values.
       return Math.min(NumberOfTabsClosedLastPerWindow.get(aWindow) || 1,
                       this.getClosedTabCount(aWindow));
     }