Bug 867097 - Remove superfluous __SS_tabStillLoading property r=yoric
authorTim Taubert <ttaubert@mozilla.com>
Fri, 22 Nov 2013 11:44:34 +0100
changeset 157154 b285dc236beff27f070ccb83a3354166c9491ec4
parent 157153 5694cdea274f5532623e0d2733cdc413bebbfdac
child 157155 ad5cc1a173bf0fe9f1ac6a9ccdc41366ec78b5c6
push id3639
push userttaubert@mozilla.com
push dateFri, 22 Nov 2013 22:09:38 +0000
treeherderfx-team@b285dc236bef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersyoric
bugs867097
milestone28.0a1
Bug 867097 - Remove superfluous __SS_tabStillLoading property r=yoric From 97efb5c74073c21963adb86513f2d1254bd7b844 Mon Sep 17 00:00:00 2001
browser/components/sessionstore/src/SessionStore.jsm
browser/components/sessionstore/src/TabState.jsm
browser/components/sessionstore/test/browser_579868.js
--- a/browser/components/sessionstore/src/SessionStore.jsm
+++ b/browser/components/sessionstore/src/SessionStore.jsm
@@ -1111,17 +1111,16 @@ let SessionStoreInternal = {
     if (this._loadState == STATE_QUITTING)
       return;
     LastSession.clear();
     let openWindows = {};
     this._forEachBrowserWindow(function(aWindow) {
       Array.forEach(aWindow.gBrowser.tabs, function(aTab) {
         TabStateCache.delete(aTab);
         delete aTab.linkedBrowser.__SS_data;
-        delete aTab.linkedBrowser.__SS_tabStillLoading;
         if (aTab.linkedBrowser.__SS_restoreState)
           this._resetTabRestoringState(aTab);
       }, this);
       openWindows[aWindow.__SSi] = true;
     });
     // also clear all data about closed tabs and windows
     for (let ix in this._windows) {
       if (ix in openWindows) {
@@ -1263,17 +1262,16 @@ let SessionStoreInternal = {
     let browser = aTab.linkedBrowser;
     browser.removeEventListener("load", this, true);
     browser.removeEventListener("SwapDocShells", this, true);
 
     let mm = browser.messageManager;
     MESSAGES.forEach(msg => mm.removeMessageListener(msg, this));
 
     delete browser.__SS_data;
-    delete browser.__SS_tabStillLoading;
 
     // If this tab was in the middle of restoring or still needs to be restored,
     // we need to reset that state. If the tab was restoring, we will attempt to
     // restore the next tab.
     let previousState = browser.__SS_restoreState;
     if (previousState) {
       this._resetTabRestoringState(aTab);
       if (previousState == TAB_STATE_RESTORING)
@@ -1344,17 +1342,16 @@ let SessionStoreInternal = {
     if (aBrowser.__SS_restoreState &&
         aBrowser.__SS_restoreState == TAB_STATE_NEEDS_RESTORE) {
       return;
     }
 
     TabStateCache.delete(aBrowser);
 
     delete aBrowser.__SS_data;
-    delete aBrowser.__SS_tabStillLoading;
     this.saveStateDelayed(aWindow);
 
     // attempt to update the current URL we send in a crash report
     this._updateCrashReportURL(aWindow);
   },
 
   /**
    * Called when a browser sends the "input" notification
@@ -2622,18 +2619,16 @@ let SessionStoreInternal = {
         delete tab.__SS_extdata;
       }
 
       // Flush all data from the content script synchronously. This is done so
       // that all async messages that are still on their way to chrome will
       // be ignored and don't override any tab data set by restoreHistory().
       TabState.flush(tab.linkedBrowser);
 
-      browser.__SS_tabStillLoading = true;
-
       // keep the data around to prevent dataloss in case
       // a tab gets closed before it's been properly restored
       browser.__SS_data = tabData;
       browser.__SS_restoreState = TAB_STATE_NEEDS_RESTORE;
       browser.setAttribute("pending", "true");
       tab.setAttribute("pending", "true");
 
       // Update the persistent tab state cache with |tabData| information.
@@ -3428,17 +3423,17 @@ let SessionStoreInternal = {
    * restoreTabs && restoreHistory) or if the tab is still marked
    * as loading.
    *
    * @param aTab
    * @returns boolean
    */
   _canRestoreTabHistory: function ssi_canRestoreTabHistory(aTab) {
     return aTab.parentNode && aTab.linkedBrowser &&
-           aTab.linkedBrowser.__SS_tabStillLoading;
+           aTab.linkedBrowser.__SS_data;
   },
 
   /**
    * This is going to take a state as provided at startup (via
    * nsISessionStartup.state) and split it into 2 parts. The first part
    * (defaultState) will be a state that should still be restored at startup,
    * while the second part (state) is a state that should be saved for later.
    * defaultState will be comprised of windows with only pinned tabs, extracted
--- a/browser/components/sessionstore/src/TabState.jsm
+++ b/browser/components/sessionstore/src/TabState.jsm
@@ -354,18 +354,17 @@ let TabStateInternal = {
     return (!browser || !browser.currentURI);
   },
 
   /*
    * Returns true if the xul:tab element is in the process of being
    * restored.
    */
   _tabIsRestoring: function (tab) {
-    let browser = tab.linkedBrowser;
-    return (browser.__SS_data && browser.__SS_tabStillLoading);
+    return !!tab.linkedBrowser.__SS_data;
   },
 
   /**
    * This function returns true if we need to collect history, page
    * style, and text and scroll data from the tab. Normally we do. The
    * cases when we don't are:
    * 1. the tab is about:blank with no history, or
    * 2. the tab is waiting to be restored.
@@ -419,17 +418,17 @@ let TabStateInternal = {
   _collectBaseTabData: function (tab) {
     let tabData = {entries: [], lastAccessed: tab.lastAccessed };
     let browser = tab.linkedBrowser;
 
     if (!browser || !browser.currentURI) {
       // can happen when calling this function right after .addTab()
       return tabData;
     }
-    if (browser.__SS_data && browser.__SS_tabStillLoading) {
+    if (browser.__SS_data) {
       // Use the data to be restored when the tab hasn't been
       // completely loaded. We clone the data, since we're updating it
       // here and the caller may update it further.
       tabData = JSON.parse(JSON.stringify(browser.__SS_data));
       if (tab.pinned)
         tabData.pinned = true;
       else
         delete tabData.pinned;
--- a/browser/components/sessionstore/test/browser_579868.js
+++ b/browser/components/sessionstore/test/browser_579868.js
@@ -13,19 +13,16 @@ function test() {
 
     // Tell the session storer that the tab is pinned
     let newTabState = '{"entries":[{"url":"about:rights"}],"pinned":true,"userTypedValue":"Hello World!"}';
     ss.setTabState(tab1, newTabState);
 
     // Undo pinning
     gBrowser.unpinTab(tab1);
 
-    is(tab1.linkedBrowser.__SS_tabStillLoading, true,
-       "_tabStillLoading should be true.");
-
     // Close and restore tab
     gBrowser.removeTab(tab1);
     let savedState = JSON.parse(ss.getClosedTabData(window))[0].state;
     isnot(savedState.pinned, true, "Pinned should not be true");
     tab1 = ss.undoCloseTab(window, 0);
 
     isnot(tab1.pinned, true, "Should not be pinned");
     gBrowser.removeTab(tab1);