Bug 366572 - clearing private data doesn't clear sessionstore.js at exit. r=dietrich

This commit is contained in:
Simon Bünzli 2008-09-08 12:22:28 +02:00
Родитель ec155217e6
Коммит 4a9ddf66eb
1 изменённых файлов: 10 добавлений и 5 удалений

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

@ -293,22 +293,27 @@ SessionStoreService.prototype = {
this._uninit(); this._uninit();
break; break;
case "browser:purge-session-history": // catch sanitization case "browser:purge-session-history": // catch sanitization
let openWindows = {};
this._forEachBrowserWindow(function(aWindow) { this._forEachBrowserWindow(function(aWindow) {
Array.forEach(aWindow.getBrowser().browsers, function(aBrowser) { Array.forEach(aWindow.getBrowser().browsers, function(aBrowser) {
delete aBrowser.parentNode.__SS_data; delete aBrowser.parentNode.__SS_data;
}); });
openWindows[aWindow.__SSi] = true;
}); });
// also clear all data about closed tabs and windows
for (ix in this._windows) {
if (ix in openWindows)
this._windows[ix]._closedTabs = [];
else
delete this._windows[ix];
}
this._lastClosedWindows = null; this._lastClosedWindows = null;
this._clearDisk(); this._clearDisk();
// also clear all data about closed tabs
for (ix in this._windows) {
this._windows[ix]._closedTabs = [];
}
// give the tabbrowsers a chance to clear their histories first // give the tabbrowsers a chance to clear their histories first
var win = this._getMostRecentBrowserWindow(); var win = this._getMostRecentBrowserWindow();
if (win) if (win)
win.setTimeout(function() { _this.saveState(true); }, 0); win.setTimeout(function() { _this.saveState(true); }, 0);
else else if (this._loadState == STATE_RUNNING)
this.saveState(true); this.saveState(true);
break; break;
case "nsPref:changed": // catch pref changes case "nsPref:changed": // catch pref changes