From 4a9ddf66eb624b7204cd020491257109fdad9076 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20B=C3=BCnzli?= Date: Mon, 8 Sep 2008 12:22:28 +0200 Subject: [PATCH] Bug 366572 - clearing private data doesn't clear sessionstore.js at exit. r=dietrich --- .../components/sessionstore/src/nsSessionStore.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/browser/components/sessionstore/src/nsSessionStore.js b/browser/components/sessionstore/src/nsSessionStore.js index fbc29caf0541..cad871b11817 100644 --- a/browser/components/sessionstore/src/nsSessionStore.js +++ b/browser/components/sessionstore/src/nsSessionStore.js @@ -293,22 +293,27 @@ SessionStoreService.prototype = { this._uninit(); break; case "browser:purge-session-history": // catch sanitization + let openWindows = {}; this._forEachBrowserWindow(function(aWindow) { Array.forEach(aWindow.getBrowser().browsers, function(aBrowser) { 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._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 var win = this._getMostRecentBrowserWindow(); if (win) win.setTimeout(function() { _this.saveState(true); }, 0); - else + else if (this._loadState == STATE_RUNNING) this.saveState(true); break; case "nsPref:changed": // catch pref changes