Bug 1209689 - Force tab restoration on demand when crashed tabs are revived. r?Mossop draft
authorMike Conley <mconley@mozilla.com>
Tue, 10 Nov 2015 21:48:06 -0500
changeset 307997 c4da1af4a4aa7bb09a7c0ffdd0176a642542275d
parent 307996 0c3e3f03e84da0245964983f462a3c36c3080f91
child 307998 feb60c04808a22258d8a15b8560be7d34c274c8a
push id7421
push usermconley@mozilla.com
push dateWed, 11 Nov 2015 04:06:00 +0000
reviewersMossop
bugs1209689
milestone45.0a1
Bug 1209689 - Force tab restoration on demand when crashed tabs are revived. r?Mossop
browser/components/sessionstore/SessionStore.jsm
--- a/browser/components/sessionstore/SessionStore.jsm
+++ b/browser/components/sessionstore/SessionStore.jsm
@@ -2225,17 +2225,19 @@ var SessionStoreInternal = {
     // We put the browser at about:blank in case the user is
     // restoring tabs on demand. This way, the user won't see
     // a flash of the about:tabcrashed page after selecting
     // the revived tab.
     aTab.removeAttribute("crashed");
     browser.loadURI("about:blank", null, null);
 
     let data = TabState.collect(aTab);
-    this.restoreTab(aTab, data);
+    this.restoreTab(aTab, data, {
+      forceOnDemand: true,
+    });
   },
 
   /**
    * Revive all crashed tabs and reset the crashed tabs count to 0.
    */
   reviveAllCrashedTabs() {
     let windowsEnum = Services.wm.getEnumerator("navigator:browser");
     while (windowsEnum.hasMoreElements()) {
@@ -2911,16 +2913,17 @@ var SessionStoreInternal = {
     NS_ASSERT(!tab.linkedBrowser.__SS_restoreState,
               "must reset tab before calling restoreTab()");
 
     let restoreImmediately = options.restoreImmediately;
     let loadArguments = options.loadArguments;
     let browser = tab.linkedBrowser;
     let window = tab.ownerDocument.defaultView;
     let tabbrowser = window.gBrowser;
+    let forceOnDemand = options.forceOnDemand;
 
     // 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);
 
@@ -3022,17 +3025,17 @@ var SessionStoreInternal = {
     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 (restoreImmediately || tabbrowser.selectedBrowser == browser || loadArguments) {
       this.restoreTabContent(tab, loadArguments);
-    } else {
+    } else if (!forceOnDemand) {
       TabRestoreQueue.add(tab);
       this.restoreNextTab();
     }
 
     // Decrease the busy state counter after we're done.
     this._setWindowStateReady(window);
   },