Discard changes to src/browser/components/sessionstore/SessionStore-sys-mjs.patch

This commit is contained in:
mr. m
2025-11-13 13:57:32 +01:00
committed by Mr. M
parent 32d603ced9
commit 00417582fb

View File

@@ -1,25 +1,17 @@
diff --git a/browser/components/sessionstore/SessionStore.sys.mjs b/browser/components/sessionstore/SessionStore.sys.mjs
index 1cdbc0f41bf5b55dfbbd850cb618c6d870f7a261..2a7d429e2ed2f2be5bb554a5fb5fd2be523e4feb 100644
index eb62ff3e733e43fdaa299babddea3ba0125abb06..8f20ba50b06f5b75d7de08eb4d1b27d89fb95494 100644
--- a/browser/components/sessionstore/SessionStore.sys.mjs
+++ b/browser/components/sessionstore/SessionStore.sys.mjs
@@ -127,6 +127,8 @@ const TAB_EVENTS = [
@@ -126,6 +126,8 @@ const TAB_EVENTS = [
"TabUngrouped",
"TabGroupCollapse",
"TabGroupExpand",
"TabSplitViewActivate",
+ "TabAddedToEssentials",
+ "TabRemovedFromEssentials",
];
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
@@ -196,6 +198,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
TabStateCache: "resource:///modules/sessionstore/TabStateCache.sys.mjs",
TabStateFlusher: "resource:///modules/sessionstore/TabStateFlusher.sys.mjs",
setTimeout: "resource://gre/modules/Timer.sys.mjs",
+ ZenSessionStore: "resource:///modules/zen/ZenSessionManager.sys.mjs",
});
ChromeUtils.defineLazyGetter(lazy, "blankURI", () => {
@@ -1911,6 +1914,8 @@ var SessionStoreInternal = {
@@ -1904,6 +1906,8 @@ var SessionStoreInternal = {
case "TabPinned":
case "TabUnpinned":
case "SwapDocShells":
@@ -28,7 +20,7 @@ index 1cdbc0f41bf5b55dfbbd850cb618c6d870f7a261..2a7d429e2ed2f2be5bb554a5fb5fd2be
this.saveStateDelayed(win);
break;
case "TabGroupCreate":
@@ -2151,7 +2156,6 @@ var SessionStoreInternal = {
@@ -2139,7 +2143,6 @@ var SessionStoreInternal = {
if (closedWindowState) {
let newWindowState;
if (
@@ -36,18 +28,7 @@ index 1cdbc0f41bf5b55dfbbd850cb618c6d870f7a261..2a7d429e2ed2f2be5bb554a5fb5fd2be
!lazy.SessionStartup.willRestore()
) {
// We want to split the window up into pinned tabs and unpinned tabs.
@@ -2215,6 +2219,10 @@ var SessionStoreInternal = {
});
this._shouldRestoreLastSession = false;
}
+ else if (!aInitialState && isRegularWindow) {
+ aInitialState = lazy.ZenSessionStore.getNewWindowData(this._windows);
+ this.restoreWindows(aWindow, aInitialState, {});
+ }
if (this._restoreLastWindow && aWindow.toolbar.visible) {
// always reset (if not a popup window)
@@ -2384,11 +2392,9 @@ var SessionStoreInternal = {
@@ -2372,11 +2375,9 @@ var SessionStoreInternal = {
tabbrowser.selectedTab.label;
}
@@ -59,7 +40,7 @@ index 1cdbc0f41bf5b55dfbbd850cb618c6d870f7a261..2a7d429e2ed2f2be5bb554a5fb5fd2be
// 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
@@ -3373,7 +3379,7 @@ var SessionStoreInternal = {
@@ -3361,7 +3362,7 @@ var SessionStoreInternal = {
if (!isPrivateWindow && tabState.isPrivate) {
return;
}
@@ -68,7 +49,7 @@ index 1cdbc0f41bf5b55dfbbd850cb618c6d870f7a261..2a7d429e2ed2f2be5bb554a5fb5fd2be
return;
}
@@ -4089,6 +4095,11 @@ var SessionStoreInternal = {
@@ -4073,6 +4074,11 @@ var SessionStoreInternal = {
Math.min(tabState.index, tabState.entries.length)
);
tabState.pinned = false;
@@ -81,7 +62,7 @@ index 1cdbc0f41bf5b55dfbbd850cb618c6d870f7a261..2a7d429e2ed2f2be5bb554a5fb5fd2be
if (inBackground === false) {
aWindow.gBrowser.selectedTab = newTab;
@@ -4525,6 +4536,7 @@ var SessionStoreInternal = {
@@ -4509,6 +4515,7 @@ var SessionStoreInternal = {
// Append the tab if we're opening into a different window,
tabIndex: aSource == aTargetWindow ? pos : Infinity,
pinned: state.pinned,
@@ -89,7 +70,7 @@ index 1cdbc0f41bf5b55dfbbd850cb618c6d870f7a261..2a7d429e2ed2f2be5bb554a5fb5fd2be
userContextId: state.userContextId,
skipLoad: true,
preferredRemoteType,
@@ -5374,7 +5386,7 @@ var SessionStoreInternal = {
@@ -5358,7 +5365,7 @@ var SessionStoreInternal = {
for (let i = tabbrowser.pinnedTabCount; i < tabbrowser.tabs.length; i++) {
let tab = tabbrowser.tabs[i];
@@ -98,7 +79,7 @@ index 1cdbc0f41bf5b55dfbbd850cb618c6d870f7a261..2a7d429e2ed2f2be5bb554a5fb5fd2be
removableTabs.push(tab);
}
}
@@ -5434,7 +5446,7 @@ var SessionStoreInternal = {
@@ -5418,7 +5425,7 @@ var SessionStoreInternal = {
}
let workspaceID = aWindow.getWorkspaceID();
@@ -107,7 +88,7 @@ index 1cdbc0f41bf5b55dfbbd850cb618c6d870f7a261..2a7d429e2ed2f2be5bb554a5fb5fd2be
winData.workspaceID = workspaceID;
}
},
@@ -5625,11 +5637,12 @@ var SessionStoreInternal = {
@@ -5609,11 +5616,12 @@ var SessionStoreInternal = {
}
let tabbrowser = aWindow.gBrowser;
@@ -121,7 +102,7 @@ index 1cdbc0f41bf5b55dfbbd850cb618c6d870f7a261..2a7d429e2ed2f2be5bb554a5fb5fd2be
// update the internal state data for this window
for (let tab of tabs) {
if (tab == aWindow.FirefoxViewHandler.tab) {
@@ -5640,6 +5653,7 @@ var SessionStoreInternal = {
@@ -5624,6 +5632,7 @@ var SessionStoreInternal = {
tabsData.push(tabData);
}
@@ -129,7 +110,7 @@ index 1cdbc0f41bf5b55dfbbd850cb618c6d870f7a261..2a7d429e2ed2f2be5bb554a5fb5fd2be
// update tab group state for this window
winData.groups = [];
for (let tabGroup of aWindow.gBrowser.tabGroups) {
@@ -5652,7 +5666,7 @@ var SessionStoreInternal = {
@@ -5636,7 +5645,7 @@ var SessionStoreInternal = {
// 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).
if (aWindow.FirefoxViewHandler.tab?.selected) {
@@ -138,7 +119,7 @@ index 1cdbc0f41bf5b55dfbbd850cb618c6d870f7a261..2a7d429e2ed2f2be5bb554a5fb5fd2be
winData.title = tabbrowser.tabs[0].label;
}
winData.selected = selectedIndex;
@@ -5764,8 +5778,8 @@ var SessionStoreInternal = {
@@ -5748,8 +5757,8 @@ var SessionStoreInternal = {
// selectTab represents.
let selectTab = 0;
if (overwriteTabs) {
@@ -149,7 +130,7 @@ index 1cdbc0f41bf5b55dfbbd850cb618c6d870f7a261..2a7d429e2ed2f2be5bb554a5fb5fd2be
selectTab = Math.min(selectTab, winData.tabs.length);
}
@@ -5808,6 +5822,8 @@ var SessionStoreInternal = {
@@ -5792,6 +5801,8 @@ var SessionStoreInternal = {
winData.tabs,
winData.groups ?? []
);
@@ -158,7 +139,7 @@ index 1cdbc0f41bf5b55dfbbd850cb618c6d870f7a261..2a7d429e2ed2f2be5bb554a5fb5fd2be
this._log.debug(
`restoreWindow, createTabsForSessionRestore returned ${tabs.length} tabs`
);
@@ -6371,6 +6387,25 @@ var SessionStoreInternal = {
@@ -6348,6 +6359,25 @@ var SessionStoreInternal = {
// Most of tabData has been restored, now continue with restoring
// attributes that may trigger external events.
@@ -172,8 +153,8 @@ index 1cdbc0f41bf5b55dfbbd850cb618c6d870f7a261..2a7d429e2ed2f2be5bb554a5fb5fd2be
+ if (tabData.zenHasStaticLabel) {
+ tab.setAttribute("zen-has-static-label", "true");
+ }
+ if (tabData.zenSyncId) {
+ tab.setAttribute("zen-sync-id", tabData.zenSyncId);
+ if (tabData.zenPinnedId) {
+ tab.setAttribute("zen-pin-id", tabData.zenPinnedId);
+ }
+ if (tabData.zenDefaultUserContextId) {
+ tab.setAttribute("zenDefaultUserContextId", true);
@@ -184,7 +165,7 @@ index 1cdbc0f41bf5b55dfbbd850cb618c6d870f7a261..2a7d429e2ed2f2be5bb554a5fb5fd2be
if (tabData.pinned) {
tabbrowser.pinTab(tab);
@@ -7289,7 +7324,7 @@ var SessionStoreInternal = {
@@ -7263,7 +7293,7 @@ var SessionStoreInternal = {
let groupsToSave = new Map();
for (let tIndex = 0; tIndex < window.tabs.length; ) {