Backed out changeset 1e57110913fc (bug 1290280) for timeouts of added test and remoteness issues e.g. in cookie tests like browser_423132.js. r=backout
authorSebastian Hengst <archaeopteryx@coole-files.de>
Sat, 13 Aug 2016 15:27:48 +0200
changeset 309305 23ca0cdcf3b07ec6433cc6b1785404ed89cf4c19
parent 309304 24b4836d23c6dcc0ee330b8fe4c3139a8a8300e6
child 309306 e79a975ce7b7b7ac7cf4c1e9325e7696dbf64d45
push id30560
push userkwierso@gmail.com
push dateMon, 15 Aug 2016 21:07:46 +0000
treeherdermozilla-central@7b74ee1d97db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1290280
milestone51.0a1
backs out1e57110913fcc1e8ff9accfe93c2975fcb9ae6a6
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
Backed out changeset 1e57110913fc (bug 1290280) for timeouts of added test and remoteness issues e.g. in cookie tests like browser_423132.js. r=backout
browser/components/sessionstore/SessionStore.jsm
--- a/browser/components/sessionstore/SessionStore.jsm
+++ b/browser/components/sessionstore/SessionStore.jsm
@@ -3211,26 +3211,18 @@ var SessionStoreInternal = {
 
     let restoreImmediately = options.restoreImmediately;
     let loadArguments = options.loadArguments;
     let browser = tab.linkedBrowser;
     let window = tab.ownerGlobal;
     let tabbrowser = window.gBrowser;
     let forceOnDemand = options.forceOnDemand;
 
-    let willRestoreImmediately = restoreImmediately ||
-                                   tabbrowser.selectedBrowser == browser ||
-                                   loadArguments;
-
-    if (!willRestoreImmediately && !forceOnDemand) {
-      TabRestoreQueue.add(tab);
-    }
-
-    this._maybeUpdateBrowserRemoteness({ tabbrowser, tab,
-                                         willRestoreImmediately });
+    this._maybeUpdateBrowserRemoteness(Object.assign({
+      browser, tabbrowser, tabData }, options));
 
     // Increase the busy state counter before modifying the tab.
     this._setWindowStateBusy(window);
 
     // It's important to set the window state to dirty so that
     // we collect their data for the first time when saving state.
     DirtyWindows.add(window);
 
@@ -3330,19 +3322,20 @@ var SessionStoreInternal = {
 
     // Restore tab attributes.
     if ("attributes" in tabData) {
       TabAttributes.set(tab, tabData.attributes);
     }
 
     // This could cause us to ignore MAX_CONCURRENT_TAB_RESTORES a bit, but
     // it ensures each window will have its selected tab loaded.
-    if (willRestoreImmediately) {
+    if (restoreImmediately || tabbrowser.selectedBrowser == browser || loadArguments) {
       this.restoreTabContent(tab, loadArguments);
     } else if (!forceOnDemand) {
+      TabRestoreQueue.add(tab);
       this.restoreNextTab();
     }
 
     // Decrease the busy state counter after we're done.
     this._setWindowStateReady(window);
   },
 
   /**
@@ -3614,57 +3607,55 @@ var SessionStoreInternal = {
     }
 
     SessionSaver.runDelayed();
   },
 
   /* ........ Auxiliary Functions .............. */
 
   /**
-   * Determines whether or not a tab that is being restored needs
-   * to have its remoteness flipped first.
+   * Determines whether or not a browser for a tab that is
+   * being restored needs to have its remoteness flipped first.
    *
    * @param (object) with the following properties:
    *
+   *        browser (<xul:browser>):
+   *          The browser for the tab being restored.
+   *
    *        tabbrowser (<xul:tabbrowser>):
    *          The tabbrowser that the browser belongs to.
    *
-   *        tab (<xul:tab>):
-   *          The tab being restored
+   *        tabData (object):
+   *          The tabData state that we're attempting to
+   *          restore for the tab.
    *
-   *        willRestoreImmediately (bool):
-   *          true if the tab is going to have its content
-   *          restored immediately by the caller.
+   *        restoreImmediately (bool):
+   *          true if loading of content should occur immediately
+   *          after restoration.
    *
+   *        forceOnDemand (bool):
+   *          true if the tab is being put into the restore-on-demand
+   *          background state.
    */
-  _maybeUpdateBrowserRemoteness({ tabbrowser, tab,
-                                  willRestoreImmediately }) {
+  _maybeUpdateBrowserRemoteness({ browser, tabbrowser, tabData,
+                                  restoreImmediately, forceOnDemand }) {
     // If the browser we're attempting to restore happens to be
     // remote, we need to flip it back to non-remote if it's going
     // to go into the pending background tab state. This is to make
-    // sure that a background tab can't crash if it hasn't yet
-    // been restored.
+    // sure that the background tab can't crash if it hasn't yet
+    // been restored. Normally, when a window is restored, the tabs
+    // that SessionStore inserts are non-remote - but the initial
+    // browser is, by default, remote, so this check and flip is
+    // mostly for that case.
     //
-    // Normally, when a window is restored, the tabs that SessionStore
-    // inserts are non-remote - but the initial browser is, by default,
-    // remote, so this check and flip covers this case. The other case
-    // is when window state is overwriting the state of an existing
-    // window with some remote tabs.
-    let browser = tab.linkedBrowser;
-
-    // There are two ways that a tab might start restoring its content
-    // very soon - either the caller is going to restore the content
-    // immediately, or the TabRestoreQueue is set up so that the tab
-    // content is going to be restored in the very near future. In
-    // either case, we don't want to flip remoteness, since the browser
-    // will soon be loading content.
-    let willRestore = willRestoreImmediately ||
-                      TabRestoreQueue.willRestoreSoon(tab);
-
-    if (browser.isRemoteBrowser && !willRestore) {
+    // Note that pinned tabs are exempt from this flip, since
+    // they'll be loaded immediately anyways.
+    if (browser.isRemoteBrowser &&
+        !tabData.pinned &&
+        (!restoreImmediately || forceOnDemand)) {
       tabbrowser.updateBrowserRemoteness(browser, false);
     }
   },
 
   /**
    * Update the session start time and send a telemetry measurement
    * for the number of days elapsed since the session was started.
    *
@@ -4431,46 +4422,17 @@ var TabRestoreQueue = {
   visibleToHidden: function (tab) {
     let {visible, hidden} = this.tabs;
     let index = visible.indexOf(tab);
 
     if (index > -1) {
       visible.splice(index, 1);
       hidden.push(tab);
     }
-  },
-
-  /**
-   * Returns true if the passed tab is in one of the sets that we're
-   * restoring content in automatically.
-   *
-   * @param tab (<xul:tab>)
-   *        The tab to check
-   * @returns bool
-   */
-  willRestoreSoon: function (tab) {
-    let { priority, hidden, visible } = this.tabs;
-    let { restoreOnDemand, restorePinnedTabsOnDemand,
-          restoreHiddenTabs } = this.prefs;
-    let restorePinned = !(restoreOnDemand && restorePinnedTabsOnDemand);
-    let candidateSet = [];
-
-    if (restorePinned && priority.length)
-      candidateSet.push(...priority);
-
-    if (!restoreOnDemand) {
-      if (visible.length)
-        candidateSet.push(...visible);
-
-      if (restoreHiddenTabs && hidden.length)
-        candidateSet.push(...hidden);
-    }
-
-    return candidateSet.indexOf(tab) > -1;
-  },
+  }
 };
 
 // A map storing a closed window's state data until it goes aways (is GC'ed).
 // This ensures that API clients can still read (but not write) states of
 // windows they still hold a reference to but we don't.
 var DyingWindowCache = {
   _data: new WeakMap(),