diff --git a/modules/base.js b/modules/base.js index b7cf696d..2e343040 100644 --- a/modules/base.js +++ b/modules/base.js @@ -928,7 +928,7 @@ var TreeStyleTabBase = { if (data && data._tabStillLoading && aTab.getAttribute('busy') != 'true' && - aTab.linkedBrowser.__SS_restoreState != 1) + !utils.isTabRestoring(aTab)) data._tabStillLoading = false; }, diff --git a/modules/browser.js b/modules/browser.js index be7bbaa2..af2d3f0a 100644 --- a/modules/browser.js +++ b/modules/browser.js @@ -936,7 +936,7 @@ TreeStyleTabBrowser.prototype = { * XXX dirty hack!!! there is no way to know when the tab is readied to be restored... */ if (!aTab.linkedBrowser.__treestyletab__toBeRestored) - aTab.linkedBrowser.__treestyletab__toBeRestored = !!aTab.linkedBrowser.__SS_restoreState; + aTab.linkedBrowser.__treestyletab__toBeRestored = utils.isTabNotRestoredYet(aTab); var b = aTab.linkedBrowser; if (!b.__treestyletab__stop) { b.__treestyletab__stop = b.stop; @@ -6305,7 +6305,7 @@ TreeStyleTabBrowser.prototype = { var tabs = this.getAllTabs(this.mTabBrowser); tabs = tabs.filter(function(aTab) { return ( - aTab.linkedBrowser.__SS_restoreState && + utils.isTabNotRestoredYet(aTab) && aTab.linkedBrowser.__treestyletab__toBeRestored && (!onlyVisible || !aTab.hidden) ); diff --git a/modules/utils.js b/modules/utils.js index 93ec9649..b0b29f46 100644 --- a/modules/utils.js +++ b/modules/utils.js @@ -233,6 +233,45 @@ let TreeStyleTabUtils = { catch(e) { } return void(0); - } + }, + + isTabNotRestoredYet: function(aTab) + { + var browser = aTab.linkedBrowser; + // Firefox 25 and later. See: https://bugzilla.mozilla.org/show_bug.cgi?id=867142 + if (this.TabRestoreStates && + this.TabRestoreStates.has(browser)) + return ( + this.TabRestoreStates.isNeedsRestore(browser) || + this.TabRestoreStates.isRestoring(browser) + ); + + return !!browser.__SS_restoreState; + }, + isTabRestoring: function(aTab) + { + var browser = aTab.linkedBrowser; + // Firefox 25 and later. See: https://bugzilla.mozilla.org/show_bug.cgi?id=867142 + if (this.TabRestoreStates && + this.TabRestoreStates.has(browser)) + return this.TabRestoreStates.isRestoring(browser); + + return browser.__SS_restoreState == 1; + }, + get TabRestoreStates() { + return this.SessionStoreNS.TabRestoreStates; + }, + get SessionStoreNS() { + if (!this._SessionStoreNS) + try { + // resource://app/modules/sessionstore/SessionStore.jsm ? + this._SessionStoreNS = Components.utils.import('resource:///modules/sessionstore/SessionStore.jsm', {}); + } + catch(e) { + this._SessionStoreNS = {}; + } + } + return this._SessionStoreNS; + } };