Bug 873556 - Add a timestamp to closedWindows and closedTabs. r=ttaubert
--- a/browser/components/sessionstore/src/SessionStore.jsm
+++ b/browser/components/sessionstore/src/SessionStore.jsm
@@ -1030,16 +1030,21 @@ let SessionStoreInternal = {
}
#ifndef XP_MACOSX
// Until we decide otherwise elsewhere, this window is part of a series
// of closing windows to quit.
winData._shouldRestore = true;
#endif
+ // Store the window's close date to figure out when each individual tab
+ // was closed. This timestamp should allow re-arranging data based on how
+ // recently something was closed.
+ winData.closedAt = Date.now();
+
// Save the window if it has multiple tabs or a single saveable tab and
// it's not private.
if (!winData.isPrivate && (winData.tabs.length > 1 ||
(winData.tabs.length == 1 && this._shouldSaveTabState(winData.tabs[0])))) {
// we don't want to save the busy state
delete winData.busy;
this._closedWindows.unshift(winData);
@@ -1343,17 +1348,18 @@ let SessionStoreInternal = {
let tabTitle = aTab.label;
let tabbrowser = aWindow.gBrowser;
tabTitle = this._replaceLoadingTitle(tabTitle, tabbrowser, aTab);
this._windows[aWindow.__SSi]._closedTabs.unshift({
state: tabState,
title: tabTitle,
image: tabbrowser.getIcon(aTab),
- pos: aTab._tPos
+ pos: aTab._tPos,
+ closedAt: Date.now()
});
var length = this._windows[aWindow.__SSi]._closedTabs.length;
if (length > this._max_tabs_undo)
this._windows[aWindow.__SSi]._closedTabs.splice(this._max_tabs_undo, length - this._max_tabs_undo);
}
},
/**