Bug 1843587 - Change getClosedTabData param to default to non-private window object r=sfoster,fxview-reviewers,sessionstore-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D183739
This commit is contained in:
Sarah Clements
2023-07-18 11:11:21 +00:00
parent 39bf8c168a
commit 80033d41ab
2 changed files with 17 additions and 12 deletions

View File

@@ -168,15 +168,17 @@ class RecentlyClosedTabsList extends MozLitElement {
getClosedTabsDataForOpenWindows() { getClosedTabsDataForOpenWindows() {
// get closed tabs in currently-open windows // get closed tabs in currently-open windows
const closedTabsData = lazy.SessionStore.getClosedTabData().map(tabData => { const closedTabsData = lazy.SessionStore.getClosedTabData(getWindow()).map(
// flatten the object; move properties of `.state` into the top-level object tabData => {
const stateData = tabData.state; // flatten the object; move properties of `.state` into the top-level object
delete tabData.state; const stateData = tabData.state;
return { delete tabData.state;
...tabData, return {
...stateData, ...tabData,
}; ...stateData,
}); };
}
);
return closedTabsData; return closedTabsData;
} }

View File

@@ -428,15 +428,18 @@ export var SessionStore = {
/** /**
* Get the closed tab data associated with all matching windows * Get the closed tab data associated with all matching windows
* @param {Window} [aWindow] Optional window argument used to determine if we're collecting data for private or non-private windows * @param {Window} [aWindow] Optional window argument used to determine if we're collecting data for private or non-private windows, will
* default to non-private only due to SessionStoreInternal._getTopWindow(false).
*/ */
getClosedTabData: function ss_getClosedTabData(aWindow) { getClosedTabData: function ss_getClosedTabData(aWindow) {
if (!SessionStoreInternal._closedTabsFromAllWindowsEnabled) { if (!SessionStoreInternal._closedTabsFromAllWindowsEnabled) {
return this.getClosedTabDataForWindow( return this.getClosedTabDataForWindow(
aWindow ?? SessionStoreInternal._getTopWindow() aWindow ?? SessionStoreInternal._getTopWindow(false)
); );
} }
return SessionStoreInternal.getClosedTabData(aWindow); return SessionStoreInternal.getClosedTabData(
aWindow ?? SessionStoreInternal._getTopWindow(false)
);
}, },
/** /**