Bug 581937 - "Recently closed tabs" list keep blank tabs [r=dietrich, a=blocking2.0:final+]

--HG--
extra : rebase_source : 510eb8ed8ecf284d568b065d45f564998ac8e1dd
This commit is contained in:
Paul O’Shannessy 2011-01-29 12:15:57 -08:00
Родитель 2dc30c13a0
Коммит 05ac51d4fb
1 изменённых файлов: 21 добавлений и 3 удалений

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

@ -877,9 +877,9 @@ SessionStoreService.prototype = {
this._updateCookies([winData]); this._updateCookies([winData]);
} }
// save the window if it has multiple tabs or a single tab with entries // save the window if it has multiple tabs or a single saveable tab
if (winData.tabs.length > 1 || if (winData.tabs.length > 1 ||
(winData.tabs.length == 1 && winData.tabs[0].entries.length > 0)) { (winData.tabs.length == 1 && this._shouldSaveTabState(winData.tabs[0]))) {
this._closedWindows.unshift(winData); this._closedWindows.unshift(winData);
this._capClosedWindows(); this._capClosedWindows();
} }
@ -984,7 +984,7 @@ SessionStoreService.prototype = {
this._updateTextAndScrollDataForTab(aWindow, aTab.linkedBrowser, tabState); this._updateTextAndScrollDataForTab(aWindow, aTab.linkedBrowser, tabState);
// store closed-tab data for undo // store closed-tab data for undo
if (tabState.entries.length > 0) { if (this._shouldSaveTabState(tabState)) {
let tabTitle = aTab.label; let tabTitle = aTab.label;
let tabbrowser = aWindow.gBrowser; let tabbrowser = aWindow.gBrowser;
tabTitle = this._replaceLoadingTitle(tabTitle, tabbrowser, aTab); tabTitle = this._replaceLoadingTitle(tabTitle, tabbrowser, aTab);
@ -3541,6 +3541,24 @@ SessionStoreService.prototype = {
sessionAge && sessionAge >= SIX_HOURS_IN_MS); sessionAge && sessionAge >= SIX_HOURS_IN_MS);
}, },
/**
* Determine if the tab state we're passed is something we should save. This
* is used when closing a tab or closing a window with a single tab
*
* @param aTabState
* The current tab state
* @returns boolean
*/
_shouldSaveTabState: function sss__shouldSaveTabState(aTabState) {
// If the tab has only the transient about:blank history entry, no other
// session history, and no userTypedValue, then we don't actually want to
// store this tab's data.
return aTabState.entries.length &&
!(aTabState.entries.length == 1 &&
aTabState.entries[0].url == "about:blank" &&
!aTabState.userTypedValue);
},
/** /**
* This is going to take a state as provided at startup (via * This is going to take a state as provided at startup (via
* nsISessionStartup.state) and split it into 2 parts. The first part * nsISessionStartup.state) and split it into 2 parts. The first part