diff --git a/src/browser/components/tabbrowser/content/tabbrowser-js.patch b/src/browser/components/tabbrowser/content/tabbrowser-js.patch index 9aaa78e55..5f81d07e5 100644 --- a/src/browser/components/tabbrowser/content/tabbrowser-js.patch +++ b/src/browser/components/tabbrowser/content/tabbrowser-js.patch @@ -1,5 +1,5 @@ diff --git a/browser/components/tabbrowser/content/tabbrowser.js b/browser/components/tabbrowser/content/tabbrowser.js -index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..1b2aacc43c3e3b9ef13a1984458fa2cbd4b1418a 100644 +index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..4f845f2175464ce24c2de0014ce102c574daf5dc 100644 --- a/browser/components/tabbrowser/content/tabbrowser.js +++ b/browser/components/tabbrowser/content/tabbrowser.js @@ -413,6 +413,7 @@ @@ -466,7 +466,7 @@ index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..1b2aacc43c3e3b9ef13a1984458fa2cb ); tabsFragment.appendChild(tabGroup.node); } -@@ -4598,9 +4729,22 @@ +@@ -4598,9 +4729,23 @@ // to remove the old selected tab. if (tabToSelect) { let leftoverTab = this.selectedTab; @@ -483,13 +483,14 @@ index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..1b2aacc43c3e3b9ef13a1984458fa2cb + } + } + } else { -+ gZenWorkspaces._keepSelectedTab = true; ++ gZenWorkspaces._keepSelectedTab = !window.__isNewZenWindow; } ++ delete window.__isNewZenWindow; + this._hasAlreadyInitializedZenSessionStore = true; if (tabs.length > 1 || !tabs[0].selected) { this._updateTabsAfterInsert(); -@@ -4791,11 +4935,14 @@ +@@ -4791,11 +4936,14 @@ if (ownerTab) { tab.owner = ownerTab; } @@ -505,7 +506,7 @@ index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..1b2aacc43c3e3b9ef13a1984458fa2cb if ( !bulkOrderedOpen && ((openerTab && -@@ -4807,7 +4954,7 @@ +@@ -4807,7 +4955,7 @@ let lastRelatedTab = openerTab && this._lastRelatedTabMap.get(openerTab); let previousTab = lastRelatedTab || openerTab || this.selectedTab; @@ -514,7 +515,7 @@ index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..1b2aacc43c3e3b9ef13a1984458fa2cb tabGroup = previousTab.group; } if ( -@@ -4823,7 +4970,7 @@ +@@ -4823,7 +4971,7 @@ previousTab.splitview ) + 1; } else if (previousTab.visible) { @@ -523,7 +524,7 @@ index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..1b2aacc43c3e3b9ef13a1984458fa2cb } else if (previousTab == FirefoxViewHandler.tab) { elementIndex = 0; } -@@ -4851,14 +4998,14 @@ +@@ -4851,14 +4999,14 @@ } // Ensure index is within bounds. if (tab.pinned) { @@ -542,7 +543,7 @@ index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..1b2aacc43c3e3b9ef13a1984458fa2cb if (pinned && !itemAfter?.pinned) { itemAfter = null; -@@ -4875,7 +5022,7 @@ +@@ -4875,7 +5023,7 @@ this.tabContainer._invalidateCachedTabs(); @@ -551,7 +552,7 @@ index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..1b2aacc43c3e3b9ef13a1984458fa2cb if ( (this.isTab(itemAfter) && itemAfter.group == tabGroup) || this.isSplitViewWrapper(itemAfter) -@@ -4906,7 +5053,11 @@ +@@ -4906,7 +5054,11 @@ const tabContainer = pinned ? this.tabContainer.pinnedTabsContainer : this.tabContainer; @@ -563,7 +564,7 @@ index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..1b2aacc43c3e3b9ef13a1984458fa2cb } if (tab.group?.collapsed) { -@@ -4921,6 +5072,7 @@ +@@ -4921,6 +5073,7 @@ if (pinned) { this._updateTabBarForPinnedTabs(); } @@ -571,7 +572,7 @@ index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..1b2aacc43c3e3b9ef13a1984458fa2cb TabBarVisibility.update(); } -@@ -5469,6 +5621,7 @@ +@@ -5469,6 +5622,7 @@ telemetrySource, } = {} ) { @@ -579,7 +580,7 @@ index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..1b2aacc43c3e3b9ef13a1984458fa2cb // When 'closeWindowWithLastTab' pref is enabled, closing all tabs // can be considered equivalent to closing the window. if ( -@@ -5558,6 +5711,7 @@ +@@ -5558,6 +5712,7 @@ if (lastToClose) { this.removeTab(lastToClose, aParams); } @@ -587,7 +588,7 @@ index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..1b2aacc43c3e3b9ef13a1984458fa2cb } catch (e) { console.error(e); } -@@ -5603,6 +5757,14 @@ +@@ -5603,6 +5758,14 @@ return; } @@ -602,7 +603,7 @@ index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..1b2aacc43c3e3b9ef13a1984458fa2cb let isVisibleTab = aTab.visible; // We have to sample the tab width now, since _beginRemoveTab might // end up modifying the DOM in such a way that aTab gets a new -@@ -5610,6 +5772,9 @@ +@@ -5610,6 +5773,9 @@ // state). let tabWidth = window.windowUtils.getBoundsWithoutFlushing(aTab).width; let isLastTab = this.#isLastTabInWindow(aTab); @@ -612,7 +613,7 @@ index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..1b2aacc43c3e3b9ef13a1984458fa2cb if ( !this._beginRemoveTab(aTab, { closeWindowFastpath: true, -@@ -5621,13 +5786,14 @@ +@@ -5621,13 +5787,14 @@ telemetrySource, }) ) { @@ -628,7 +629,7 @@ index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..1b2aacc43c3e3b9ef13a1984458fa2cb let lockTabSizing = !this.tabContainer.verticalMode && !aTab.pinned && -@@ -5658,7 +5824,13 @@ +@@ -5658,7 +5825,13 @@ // We're not animating, so we can cancel the animation stopwatch. Glean.browserTabclose.timeAnim.cancel(aTab._closeTimeAnimTimerId); aTab._closeTimeAnimTimerId = null; @@ -643,7 +644,7 @@ index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..1b2aacc43c3e3b9ef13a1984458fa2cb return; } -@@ -5792,7 +5964,7 @@ +@@ -5792,7 +5965,7 @@ closeWindowWithLastTab != null ? closeWindowWithLastTab : !window.toolbar.visible || @@ -652,7 +653,7 @@ index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..1b2aacc43c3e3b9ef13a1984458fa2cb if (closeWindow) { // We've already called beforeunload on all the relevant tabs if we get here, -@@ -5816,6 +5988,7 @@ +@@ -5816,6 +5989,7 @@ newTab = true; } @@ -660,7 +661,7 @@ index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..1b2aacc43c3e3b9ef13a1984458fa2cb aTab._endRemoveArgs = [closeWindow, newTab]; // swapBrowsersAndCloseOther will take care of closing the window without animation. -@@ -5856,13 +6029,7 @@ +@@ -5856,13 +6030,7 @@ aTab._mouseleave(); if (newTab) { @@ -675,7 +676,7 @@ index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..1b2aacc43c3e3b9ef13a1984458fa2cb } else { TabBarVisibility.update(); } -@@ -5995,6 +6162,7 @@ +@@ -5995,6 +6163,7 @@ this.tabs[i]._tPos = i; } @@ -683,7 +684,7 @@ index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..1b2aacc43c3e3b9ef13a1984458fa2cb if (!this._windowIsClosing) { // update tab close buttons state this.tabContainer._updateCloseButtons(); -@@ -6180,6 +6348,7 @@ +@@ -6180,6 +6349,7 @@ memory_after: await getTotalMemoryUsage(), time_to_unload_in_ms: timeElapsed, }); @@ -691,7 +692,7 @@ index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..1b2aacc43c3e3b9ef13a1984458fa2cb } /** -@@ -6225,6 +6394,7 @@ +@@ -6225,6 +6395,7 @@ } let excludeTabs = new Set(aExcludeTabs); @@ -699,7 +700,7 @@ index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..1b2aacc43c3e3b9ef13a1984458fa2cb // If this tab has a successor, it should be selectable, since // hiding or closing a tab removes that tab as a successor. -@@ -6237,15 +6407,22 @@ +@@ -6237,15 +6408,22 @@ !excludeTabs.has(aTab.owner) && Services.prefs.getBoolPref("browser.tabs.selectOwnerOnClose") ) { @@ -724,7 +725,7 @@ index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..1b2aacc43c3e3b9ef13a1984458fa2cb let tab = this.tabContainer.findNextTab(aTab, { direction: 1, filter: _tab => remainingTabs.includes(_tab), -@@ -6259,7 +6436,7 @@ +@@ -6259,7 +6437,7 @@ } if (tab) { @@ -733,7 +734,7 @@ index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..1b2aacc43c3e3b9ef13a1984458fa2cb } // If no qualifying visible tab was found, see if there is a tab in -@@ -6280,7 +6457,7 @@ +@@ -6280,7 +6458,7 @@ }); } @@ -742,7 +743,7 @@ index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..1b2aacc43c3e3b9ef13a1984458fa2cb } _blurTab(aTab) { -@@ -6291,7 +6468,7 @@ +@@ -6291,7 +6469,7 @@ * @returns {boolean} * False if swapping isn't permitted, true otherwise. */ @@ -751,7 +752,7 @@ index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..1b2aacc43c3e3b9ef13a1984458fa2cb // Do not allow transfering a private tab to a non-private window // and vice versa. if ( -@@ -6345,6 +6522,7 @@ +@@ -6345,6 +6523,7 @@ // fire the beforeunload event in the process. Close the other // window if this was its last tab. if ( @@ -759,7 +760,7 @@ index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..1b2aacc43c3e3b9ef13a1984458fa2cb !remoteBrowser._beginRemoveTab(aOtherTab, { adoptedByTab: aOurTab, closeWindowWithLastTab: true, -@@ -6356,7 +6534,7 @@ +@@ -6356,7 +6535,7 @@ // If this is the last tab of the window, hide the window // immediately without animation before the docshell swap, to avoid // about:blank being painted. @@ -768,7 +769,7 @@ index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..1b2aacc43c3e3b9ef13a1984458fa2cb if (closeWindow) { let win = aOtherTab.ownerGlobal; win.windowUtils.suppressAnimation(true); -@@ -6484,11 +6662,13 @@ +@@ -6484,11 +6663,13 @@ } // Finish tearing down the tab that's going away. @@ -782,7 +783,7 @@ index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..1b2aacc43c3e3b9ef13a1984458fa2cb this.setTabTitle(aOurTab); -@@ -6690,10 +6870,10 @@ +@@ -6690,10 +6871,10 @@ SessionStore.deleteCustomTabValue(aTab, "hiddenBy"); } @@ -795,7 +796,7 @@ index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..1b2aacc43c3e3b9ef13a1984458fa2cb aTab.selected || aTab.closing || // Tabs that are sharing the screen, microphone or camera cannot be hidden. -@@ -6753,7 +6933,8 @@ +@@ -6753,7 +6934,8 @@ * @param {object} [aOptions={}] * Key-value pairs that will be serialized into the features string. */ @@ -805,7 +806,7 @@ index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..1b2aacc43c3e3b9ef13a1984458fa2cb if (this.tabs.length == 1) { return null; } -@@ -6770,7 +6951,7 @@ +@@ -6770,7 +6952,7 @@ // tell a new window to take the "dropped" tab let args = Cc["@mozilla.org/array;1"].createInstance(Ci.nsIMutableArray); args.appendElement(aTab.splitview ?? aTab); @@ -814,7 +815,7 @@ index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..1b2aacc43c3e3b9ef13a1984458fa2cb private: PrivateBrowsingUtils.isWindowPrivate(window), features: Object.entries(aOptions) .map(([key, value]) => `${key}=${value}`) -@@ -6778,6 +6959,8 @@ +@@ -6778,6 +6960,8 @@ openerWindow: window, args, }); @@ -823,7 +824,7 @@ index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..1b2aacc43c3e3b9ef13a1984458fa2cb } /** -@@ -6890,7 +7073,7 @@ +@@ -6890,7 +7074,7 @@ * `true` if element is a `` */ isTabGroup(element) { @@ -832,7 +833,7 @@ index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..1b2aacc43c3e3b9ef13a1984458fa2cb } /** -@@ -6975,8 +7158,8 @@ +@@ -6975,8 +7159,8 @@ } // Don't allow mixing pinned and unpinned tabs. @@ -843,7 +844,7 @@ index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..1b2aacc43c3e3b9ef13a1984458fa2cb } else { tabIndex = Math.max(tabIndex, this.pinnedTabCount); } -@@ -7005,13 +7188,19 @@ +@@ -7005,13 +7189,19 @@ this.#handleTabMove( element, () => { @@ -865,7 +866,7 @@ index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..1b2aacc43c3e3b9ef13a1984458fa2cb let useAfter = false; if (this.isTab(element)) { useAfter = neighbor && tabIndex > element._tPos; -@@ -7076,23 +7265,31 @@ +@@ -7076,23 +7266,31 @@ #moveTabNextTo(element, targetElement, moveBefore = false, metricsContext) { if (this.isTabGroupLabel(targetElement)) { targetElement = targetElement.group; @@ -903,7 +904,7 @@ index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..1b2aacc43c3e3b9ef13a1984458fa2cb } else if (!element.pinned && targetElement && targetElement.pinned) { // If the caller asks to move an unpinned element next to a pinned // tab, move the unpinned element to be the first unpinned element -@@ -7105,12 +7302,35 @@ +@@ -7105,12 +7303,35 @@ // move the tab group right before the first unpinned tab. // 4. Moving a tab group and the first unpinned tab is grouped: // move the tab group right before the first unpinned tab's tab group. @@ -940,7 +941,7 @@ index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..1b2aacc43c3e3b9ef13a1984458fa2cb // We want to include the splitview wrapper if it's the targetElement, but // not in the case where we want to reverse tabs within the same splitview. -@@ -7119,6 +7339,7 @@ +@@ -7119,6 +7340,7 @@ } let getContainer = () => @@ -948,7 +949,7 @@ index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..1b2aacc43c3e3b9ef13a1984458fa2cb element.pinned ? this.tabContainer.pinnedTabsContainer : this.tabContainer; -@@ -7127,11 +7348,15 @@ +@@ -7127,11 +7349,15 @@ element, () => { if (moveBefore) { @@ -965,7 +966,7 @@ index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..1b2aacc43c3e3b9ef13a1984458fa2cb } }, metricsContext -@@ -7205,10 +7430,10 @@ +@@ -7205,10 +7431,10 @@ * @param {TabMetricsContext} [metricsContext] */ moveTabToExistingGroup(aTab, aGroup, metricsContext) { @@ -978,7 +979,7 @@ index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..1b2aacc43c3e3b9ef13a1984458fa2cb return; } if (aTab.group && aTab.group.id === aGroup.id) { -@@ -7281,6 +7506,7 @@ +@@ -7281,6 +7507,7 @@ let state = { tabIndex: tab._tPos, @@ -986,7 +987,7 @@ index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..1b2aacc43c3e3b9ef13a1984458fa2cb }; if (tab.visible) { state.elementIndex = tab.elementIndex; -@@ -7312,7 +7538,7 @@ +@@ -7312,7 +7539,7 @@ let changedSplitView = previousTabState.splitViewId != currentTabState.splitViewId; @@ -995,7 +996,7 @@ index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..1b2aacc43c3e3b9ef13a1984458fa2cb tab.dispatchEvent( new CustomEvent("TabMove", { bubbles: true, -@@ -7354,6 +7580,10 @@ +@@ -7354,6 +7581,10 @@ moveActionCallback(); @@ -1006,7 +1007,7 @@ index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..1b2aacc43c3e3b9ef13a1984458fa2cb // Clear tabs cache after moving nodes because the order of tabs may have // changed. this.tabContainer._invalidateCachedTabs(); -@@ -7404,7 +7634,22 @@ +@@ -7404,7 +7635,22 @@ * @returns {object} * The new tab in the current window, null if the tab couldn't be adopted. */ @@ -1030,7 +1031,7 @@ index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..1b2aacc43c3e3b9ef13a1984458fa2cb // Swap the dropped tab with a new one we create and then close // it in the other window (making it seem to have moved between // windows). We also ensure that the tab we create to swap into has -@@ -7447,6 +7692,8 @@ +@@ -7447,6 +7693,8 @@ } params.skipLoad = true; let newTab = this.addWebTab("about:blank", params); @@ -1039,7 +1040,7 @@ index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..1b2aacc43c3e3b9ef13a1984458fa2cb aTab.container.tabDragAndDrop.finishAnimateTabMove(); -@@ -8149,7 +8396,7 @@ +@@ -8149,7 +8397,7 @@ // preventDefault(). It will still raise the window if appropriate. return; } @@ -1048,7 +1049,7 @@ index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..1b2aacc43c3e3b9ef13a1984458fa2cb window.focus(); aEvent.preventDefault(); } -@@ -8166,7 +8413,6 @@ +@@ -8166,7 +8414,6 @@ on_TabGroupCollapse(aEvent) { aEvent.target.tabs.forEach(tab => { @@ -1056,7 +1057,7 @@ index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..1b2aacc43c3e3b9ef13a1984458fa2cb }); } -@@ -8500,7 +8746,9 @@ +@@ -8500,7 +8747,9 @@ let filter = this._tabFilters.get(tab); if (filter) { @@ -1066,7 +1067,7 @@ index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..1b2aacc43c3e3b9ef13a1984458fa2cb let listener = this._tabListeners.get(tab); if (listener) { -@@ -9306,6 +9554,7 @@ +@@ -9306,6 +9555,7 @@ aWebProgress.isTopLevel ) { this.mTab.setAttribute("busy", "true"); @@ -1074,7 +1075,7 @@ index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..1b2aacc43c3e3b9ef13a1984458fa2cb gBrowser._tabAttrModified(this.mTab, ["busy"]); this.mTab._notselectedsinceload = !this.mTab.selected; } -@@ -9386,6 +9635,7 @@ +@@ -9386,6 +9636,7 @@ // known defaults. Note we use the original URL since about:newtab // redirects to a prerendered page. const shouldRemoveFavicon = @@ -1082,7 +1083,7 @@ index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..1b2aacc43c3e3b9ef13a1984458fa2cb !this.mBrowser.mIconURL && !ignoreBlank && !(originalLocation.spec in FAVICON_DEFAULTS); -@@ -9560,13 +9810,6 @@ +@@ -9560,13 +9811,6 @@ this.mBrowser.originalURI = aRequest.originalURI; } @@ -1096,7 +1097,7 @@ index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..1b2aacc43c3e3b9ef13a1984458fa2cb } let userContextId = this.mBrowser.getAttribute("usercontextid") || 0; -@@ -10450,7 +10693,7 @@ var TabContextMenu = { +@@ -10450,7 +10694,7 @@ var TabContextMenu = { ); contextUnpinSelectedTabs.hidden = !this.contextTab.pinned || !this.multiselected; diff --git a/src/zen/sessionstore/ZenSessionManager.sys.mjs b/src/zen/sessionstore/ZenSessionManager.sys.mjs index ae2321a76..f784e1656 100644 --- a/src/zen/sessionstore/ZenSessionManager.sys.mjs +++ b/src/zen/sessionstore/ZenSessionManager.sys.mjs @@ -897,6 +897,7 @@ export class nsZenSessionManager { const newState = { windows: [newWindow] }; this.log(`Cloning window with ${newWindow.tabs.length} tabs`); + aWindow.__isNewZenWindow = true; SessionStoreInternal._deferredInitialState = newState; SessionStoreInternal.initializeWindow(aWindow, newState); }