feat: Do restore previously closed windows on macos after clicking on the X button, b=(bug #7079), c=no-component

This commit is contained in:
mr. m
2025-05-05 18:28:33 +02:00
parent cc2c9044f3
commit 3f2dd0a60c

View File

@@ -1,8 +1,30 @@
diff --git a/browser/components/sessionstore/SessionStore.sys.mjs b/browser/components/sessionstore/SessionStore.sys.mjs
index 5633e5032f5d50c70512187d27e045b579978927..dd7aa4827eaa809dadc7e1fe6cdd1083e79f383a 100644
index 5633e5032f5d50c70512187d27e045b579978927..34bc7a07a3b47a1571760b7a4b2b006772daff3c 100644
--- a/browser/components/sessionstore/SessionStore.sys.mjs
+++ b/browser/components/sessionstore/SessionStore.sys.mjs
@@ -3202,7 +3202,7 @@ var SessionStoreInternal = {
@@ -2081,7 +2081,6 @@ var SessionStoreInternal = {
if (closedWindowState) {
let newWindowState;
if (
- AppConstants.platform == "macosx" ||
!lazy.SessionStartup.willRestore()
) {
// We want to split the window up into pinned tabs and unpinned tabs.
@@ -2296,12 +2295,10 @@ var SessionStoreInternal = {
tabbrowser.selectedTab.label;
}
- if (AppConstants.platform != "macosx") {
// Until we decide otherwise elsewhere, this window is part of a series
// of closing windows to quit.
winData._shouldRestore = true;
- }
-
+
// 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.
@@ -3202,7 +3199,7 @@ var SessionStoreInternal = {
if (!isPrivateWindow && tabState.isPrivate) {
return;
}
@@ -11,7 +33,7 @@ index 5633e5032f5d50c70512187d27e045b579978927..dd7aa4827eaa809dadc7e1fe6cdd1083
return;
}
@@ -3911,6 +3911,9 @@ var SessionStoreInternal = {
@@ -3911,6 +3908,9 @@ var SessionStoreInternal = {
Math.min(tabState.index, tabState.entries.length)
);
tabState.pinned = false;
@@ -21,7 +43,7 @@ index 5633e5032f5d50c70512187d27e045b579978927..dd7aa4827eaa809dadc7e1fe6cdd1083
if (inBackground === false) {
aWindow.gBrowser.selectedTab = newTab;
@@ -5416,14 +5419,15 @@ var SessionStoreInternal = {
@@ -5416,14 +5416,15 @@ var SessionStoreInternal = {
}
let tabbrowser = aWindow.gBrowser;
@@ -39,7 +61,7 @@ index 5633e5032f5d50c70512187d27e045b579978927..dd7aa4827eaa809dadc7e1fe6cdd1083
continue;
}
let tabData = lazy.TabState.collect(tab, TAB_CUSTOM_VALUES.get(tab));
@@ -5442,7 +5446,7 @@ var SessionStoreInternal = {
@@ -5442,7 +5443,7 @@ var SessionStoreInternal = {
// We don't store the Firefox View tab in Session Store, so if it was the last selected "tab" when
// a window is closed, point to the first item in the tab strip instead (it will never be the Firefox View tab,
// since it's only inserted into the tab strip after it's selected).
@@ -48,7 +70,7 @@ index 5633e5032f5d50c70512187d27e045b579978927..dd7aa4827eaa809dadc7e1fe6cdd1083
selectedIndex = 1;
winData.title = tabbrowser.tabs[0].label;
}
@@ -5599,6 +5603,7 @@ var SessionStoreInternal = {
@@ -5599,6 +5600,7 @@ var SessionStoreInternal = {
winData.tabs,
winData.groups ?? []
);
@@ -56,7 +78,7 @@ index 5633e5032f5d50c70512187d27e045b579978927..dd7aa4827eaa809dadc7e1fe6cdd1083
this._log.debug(
`restoreWindow, createTabsForSessionRestore returned ${tabs.length} tabs`
);
@@ -6148,8 +6153,23 @@ var SessionStoreInternal = {
@@ -6148,8 +6150,23 @@ var SessionStoreInternal = {
// Most of tabData has been restored, now continue with restoring
// attributes that may trigger external events.