Detect number of "not restored yet" tabs on Firefox 29 and later correctly

This commit is contained in:
Piro / YUKI Hiroshi 2014-02-09 01:38:55 +09:00
parent 8a2989c03e
commit 67aa67a67f
2 changed files with 23 additions and 4 deletions

View File

@ -6517,18 +6517,34 @@ TreeStyleTabBrowser.prototype = {
return; return;
var level = utils.getTreePref('restoreTree.level'); var level = utils.getTreePref('restoreTree.level');
var tabs = this.getAllTabs(this.mTabBrowser);
var tabsToRestore = 0;
if (utils.SessionStoreInternal &&
utils.SessionStoreInternal._browserEpochs) {
// for Firefox 29 and later
// (after https://bugzilla.mozilla.org/show_bug.cgi?id=942374)
var browserEpochs = utils.SessionStoreInternal._browserEpochs;
tabsToRestore = tabs.filter(function(aTab) {
return browserEpochs.has(aTab.linkedBrowser.permanentKey);
}).length;
}
else {
// for Firefox 24 and old versions
tabsToRestore = this.window.__SS_tabsToRestore;
}
dump('TSTBrowser::restoreTree\n'); dump('TSTBrowser::restoreTree\n');
dump(' level = '+level+'\n'); dump(' level = '+level+'\n');
dump(' tabsToRestore = '+this.window.__SS_tabsToRestore+'\n'); dump(' tabsToRestore = '+tabsToRestore+'\n');
if ( if (
level <= this.kRESTORE_TREE_LEVEL_NONE || level <= this.kRESTORE_TREE_LEVEL_NONE ||
!this.window.__SS_tabsToRestore || !tabsToRestore ||
this.window.__SS_tabsToRestore <= 1 tabsToRestore <= 1
) )
return; return;
var onlyVisible = level <= this.kRESTORE_TREE_ONLY_VISIBLE; var onlyVisible = level <= this.kRESTORE_TREE_ONLY_VISIBLE;
var tabs = this.getAllTabs(this.mTabBrowser);
tabs = tabs.filter(function(aTab) { tabs = tabs.filter(function(aTab) {
return ( return (
utils.isTabNotRestoredYet(aTab) && utils.isTabNotRestoredYet(aTab) &&

View File

@ -267,6 +267,9 @@ let TreeStyleTabUtils = {
return browser.__SS_restoreState == 1; return browser.__SS_restoreState == 1;
}, },
get SessionStoreInternal() {
return this.SessionStoreNS.SessionStoreInternal;
},
get TabRestoreStates() { get TabRestoreStates() {
return this.SessionStoreNS.TabRestoreStates; return this.SessionStoreNS.TabRestoreStates;
}, },