Bug 1162036 - Remove pending/restoring tabs when receiving browser:purge-session-history instead of leaving empty tabs r=Yoric

This commit is contained in:
Tim Taubert 2015-05-07 08:00:16 +02:00
Родитель a24f442a0c
Коммит 7e3c78f219
1 изменённых файлов: 10 добавлений и 5 удалений

Просмотреть файл

@ -1258,11 +1258,13 @@ let SessionStoreInternal = {
LastSession.clear();
let openWindows = {};
this._forEachBrowserWindow(function(aWindow) {
Array.forEach(aWindow.gBrowser.tabs, function(aTab) {
delete aTab.linkedBrowser.__SS_data;
if (aTab.linkedBrowser.__SS_restoreState)
this._resetTabRestoringState(aTab);
}, this);
let tabs = aWindow.gBrowser.tabs;
// Remove pending or restoring tabs instead of just emptying them.
for (let i = tabs.length - 1; i >= 0 && tabs.length > 1; i--) {
if (tabs[i].linkedBrowser.__SS_restoreState) {
aWindow.gBrowser.removeTab(tabs[i], {animate: false});
}
}
openWindows[aWindow.__SSi] = true;
});
// also clear all data about closed tabs and windows
@ -1273,6 +1275,9 @@ let SessionStoreInternal = {
delete this._windows[ix];
}
}
// Remove all pointers so that pending/restoring tabs that were closed
// above do not end up in _closedTabs[] again.
this._closedTabs.clear();
// also clear all data about closed windows
this._closedWindows = [];
// give the tabbrowsers a chance to clear their histories first