From 88b294364f7b478bd595942835d97c23efee1884 Mon Sep 17 00:00:00 2001 From: Dan Xin Date: Fri, 12 Jun 2026 02:05:25 +0800 Subject: [PATCH 1/8] gh-9540: duplicated bookmarks on macOS window reopen (gh-14113) Signed-off-by: Dan Xin --- src/zen/common/modules/ZenStartup.mjs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/zen/common/modules/ZenStartup.mjs b/src/zen/common/modules/ZenStartup.mjs index 93e549f56..307fa0dbf 100644 --- a/src/zen/common/modules/ZenStartup.mjs +++ b/src/zen/common/modules/ZenStartup.mjs @@ -100,7 +100,16 @@ class ZenStartup { delete this.promiseInitializedResolve; setTimeout(() => { - gZenWorkspaces._invalidateBookmarkContainers(); + // Wait for the natural PlacesToolbar rebuild before invalidating, so + // the two async rebuilds don't interleave and duplicate bookmarks. + // promiseRebuilt() returns undefined when no rebuild is in flight. + const rebuilt = + document + .getElementById("PlacesToolbar") + ?._placesView?.promiseRebuilt() ?? Promise.resolve(); + rebuilt + .catch(console.error) + .then(() => gZenWorkspaces._invalidateBookmarkContainers()); }); }); } From 4797717353c4c220f303ca8492cf3d282f2268b9 Mon Sep 17 00:00:00 2001 From: "mr. m" <91018726+mr-cheffy@users.noreply.github.com> Date: Thu, 11 Jun 2026 23:56:27 +0200 Subject: [PATCH 2/8] gh-14110: Fixed tab freezing when switching spaces (gh-14124) --- .../tabbrowser/content/tabbrowser-js.patch | 184 +++++++++--------- src/zen/spaces/ZenSpaceManager.mjs | 8 +- src/zen/urlbar/ZenSiteDataPanel.sys.mjs | 4 +- surfer.json | 2 +- 4 files changed, 104 insertions(+), 94 deletions(-) diff --git a/src/browser/components/tabbrowser/content/tabbrowser-js.patch b/src/browser/components/tabbrowser/content/tabbrowser-js.patch index 90ad2574e..0edeeb8d7 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 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a70e59c10 100644 +index 43fb79a3060e20f671ae6ffc26350c7abf497702..f4a5daa70374bbf7b3f42a6023b346dccad2a0be 100644 --- a/browser/components/tabbrowser/content/tabbrowser.js +++ b/browser/components/tabbrowser/content/tabbrowser.js @@ -502,6 +502,7 @@ @@ -79,15 +79,17 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a set selectedTab(val) { if ( gSharedTabWarning.willShowSharedTabWarning(val) || -@@ -592,6 +644,7 @@ +@@ -592,6 +644,9 @@ ) { return; } -+ gZenWorkspaces.onBeforeTabSelect(val); ++ if (gZenWorkspaces.onBeforeTabSelect(val)) { ++ return; ++ } // Update the tab this.tabbox.selectedTab = val; } -@@ -659,6 +712,10 @@ +@@ -659,6 +714,10 @@ userContextId = parseInt(tabArgument.getAttribute("usercontextid"), 10); } @@ -98,7 +100,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a if (tabArgument && tabArgument.linkedBrowser) { remoteType = tabArgument.linkedBrowser.remoteType; initialBrowsingContextGroupId = -@@ -751,6 +808,8 @@ +@@ -751,6 +810,8 @@ this.tabpanels.appendChild(panel); let tab = this.tabs[0]; @@ -107,7 +109,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a tab.linkedPanel = uniqueId; this._selectedTab = tab; this._selectedBrowser = browser; -@@ -1121,13 +1180,18 @@ +@@ -1121,13 +1182,18 @@ } this.showTab(aTab); @@ -127,7 +129,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a aTab.setAttribute("pinned", "true"); this._updateTabBarForPinnedTabs(); -@@ -1140,11 +1204,19 @@ +@@ -1140,11 +1206,19 @@ } this.#handleTabMove(aTab, () => { @@ -148,7 +150,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a }); aTab.style.marginInlineStart = ""; -@@ -1321,6 +1393,9 @@ +@@ -1321,6 +1395,9 @@ let LOCAL_PROTOCOLS = ["chrome:", "about:", "resource:", "data:"]; @@ -158,7 +160,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a if ( aIconURL && !LOCAL_PROTOCOLS.some(protocol => aIconURL.startsWith(protocol)) -@@ -1330,6 +1405,9 @@ +@@ -1330,6 +1407,9 @@ ); return; } @@ -168,7 +170,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a let browser = this.getBrowserForTab(aTab); browser.mIconURL = aIconURL; -@@ -1652,7 +1730,6 @@ +@@ -1652,7 +1732,6 @@ // Preview mode should not reset the owner if (!this._previewMode && !oldTab.selected) { @@ -176,7 +178,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a } let lastRelatedTab = this._lastRelatedTabMap.get(oldTab); -@@ -1743,6 +1820,7 @@ +@@ -1743,6 +1822,7 @@ if (!this._previewMode) { newTab.recordTimeFromUnloadToReload(); newTab.updateLastAccessed(); @@ -184,7 +186,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a oldTab.updateLastAccessed(); // if this is the foreground window, update the last-seen timestamps. if (this.ownerGlobal == BrowserWindowTracker.getTopWindow()) { -@@ -1957,6 +2035,9 @@ +@@ -1957,6 +2037,9 @@ } let activeEl = document.activeElement; @@ -194,7 +196,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a // If focus is on the old tab, move it to the new tab. if (activeEl == oldTab) { newTab.focus(); -@@ -1995,7 +2076,7 @@ +@@ -1995,7 +2078,7 @@ // Focus the location bar if it was previously focused for that tab. // In full screen mode, only bother making the location bar visible // if the tab is a blank one. @@ -203,7 +205,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a let selectURL = () => { if (this._asyncTabSwitching) { // Set _awaitingSetURI flag to suppress popup notification -@@ -2283,7 +2364,12 @@ +@@ -2283,7 +2366,12 @@ return this._setTabLabel(aTab, aLabel); } @@ -217,7 +219,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a if (!aLabel || (isURL && /^about:reader\?url=/.test(aLabel))) { return false; } -@@ -2408,7 +2494,7 @@ +@@ -2408,7 +2496,7 @@ newIndex = this.selectedTab._tPos + 1; } @@ -226,7 +228,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a if (this.isTabGroupLabel(targetTab)) { throw new Error( "Replacing a tab group label with a tab is not supported" -@@ -2685,6 +2771,7 @@ +@@ -2685,6 +2773,7 @@ uriIsAboutBlank, userContextId, skipLoad, @@ -234,7 +236,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a } = {}) { let b = document.createXULElement("browser"); // Use the JSM global to create the permanentKey, so that if the -@@ -2758,8 +2845,7 @@ +@@ -2758,8 +2847,7 @@ // we use a different attribute name for this? b.setAttribute("name", name); } @@ -244,7 +246,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a b.setAttribute("transparent", "true"); } -@@ -2929,7 +3015,7 @@ +@@ -2929,7 +3017,7 @@ let panel = this.getPanel(browser); let uniqueId = this._generateUniquePanelID(); @@ -253,7 +255,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a aTab.linkedPanel = uniqueId; // Inject the into the DOM if necessary. -@@ -2989,8 +3075,8 @@ +@@ -2989,8 +3077,8 @@ // If we transitioned from one browser to two browsers, we need to set // hasSiblings=false on both the existing browser and the new browser. if (this.tabs.length == 2) { @@ -264,7 +266,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a } else { aTab.linkedBrowser.browsingContext.hasSiblings = this.tabs.length > 1; } -@@ -3175,7 +3261,6 @@ +@@ -3175,7 +3263,6 @@ this.selectedTab = this.addTrustedTab(BROWSER_NEW_TAB_URL, { tabIndex: tab._tPos + 1, userContextId: tab.userContextId, @@ -272,7 +274,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a focusUrlBar: true, }); resolve(this.selectedBrowser); -@@ -3285,6 +3370,10 @@ +@@ -3285,6 +3372,10 @@ schemelessInput, hasValidUserGestureActivation = false, textDirectiveUserActivation = false, @@ -283,7 +285,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a } = {} ) { // all callers of addTab that pass a params object need to pass -@@ -3295,10 +3384,25 @@ +@@ -3295,10 +3386,25 @@ ); } @@ -309,7 +311,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a // If we're opening a foreground tab, set the owner by default. ownerTab ??= inBackground ? null : this.selectedTab; -@@ -3306,6 +3410,7 @@ +@@ -3306,6 +3412,7 @@ if (this.selectedTab.owner) { this.selectedTab.owner = null; } @@ -317,7 +319,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a // Find the tab that opened this one, if any. This is used for // determining positioning, and inherited attributes such as the -@@ -3358,6 +3463,22 @@ +@@ -3358,6 +3465,22 @@ noInitialLabel, skipBackgroundNotify, }); @@ -340,7 +342,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a if (insertTab) { // Insert the tab into the tab container in the correct position. this.#insertTabAtIndex(t, { -@@ -3366,6 +3487,7 @@ +@@ -3366,6 +3489,7 @@ ownerTab, openerTab, pinned, @@ -348,7 +350,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a bulkOrderedOpen, tabGroup: tabGroup ?? openerTab?.group, }); -@@ -3384,6 +3506,7 @@ +@@ -3384,6 +3508,7 @@ openWindowInfo, skipLoad, triggeringRemoteType, @@ -356,7 +358,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a })); if (focusUrlBar) { -@@ -3508,6 +3631,12 @@ +@@ -3508,6 +3633,12 @@ } } @@ -369,7 +371,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a // Additionally send pinned tab events if (pinned) { this.#notifyPinnedStatus(t); -@@ -3518,6 +3647,9 @@ +@@ -3518,6 +3649,9 @@ if (!inBackground) { this.selectedTab = t; } @@ -379,7 +381,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a return t; } -@@ -3750,6 +3882,7 @@ +@@ -3750,6 +3884,7 @@ isAdoptingGroup = false, isUserTriggered = false, telemetryUserCreateSource = "unknown", @@ -387,7 +389,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a } = {} ) { if ( -@@ -3760,9 +3893,6 @@ +@@ -3760,9 +3895,6 @@ !this.isSplitViewWrapper(tabOrSplitView) ) ) { @@ -397,7 +399,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a } if (!color) { -@@ -3783,9 +3913,14 @@ +@@ -3783,9 +3915,14 @@ label, isAdoptingGroup ); @@ -414,7 +416,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a ); group.addTabs(tabsAndSplitViews); -@@ -3906,7 +4041,7 @@ +@@ -3906,7 +4043,7 @@ } this.#handleTabMove(tab, () => @@ -423,7 +425,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a ); } -@@ -3990,6 +4125,7 @@ +@@ -3990,6 +4127,7 @@ color: group.color, insertBefore: newTabs[0], isAdoptingGroup: true, @@ -431,7 +433,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a }); } -@@ -4200,6 +4336,7 @@ +@@ -4200,6 +4338,7 @@ openWindowInfo, skipLoad, triggeringRemoteType, @@ -439,7 +441,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a } ) { // If we don't have a preferred remote type (or it is `NOT_REMOTE`), and -@@ -4269,6 +4406,7 @@ +@@ -4269,6 +4408,7 @@ openWindowInfo, name, skipLoad, @@ -447,7 +449,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a }); } -@@ -4482,9 +4620,9 @@ +@@ -4482,9 +4622,9 @@ } // Add a new tab if needed. @@ -459,7 +461,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a let url = "about:blank"; if (tabData.entries?.length) { -@@ -4521,8 +4659,10 @@ +@@ -4521,8 +4661,10 @@ insertTab: false, skipLoad: true, preferredRemoteType, @@ -471,7 +473,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a if (select) { tabToSelect = tab; } -@@ -4544,7 +4684,8 @@ +@@ -4544,7 +4686,8 @@ this.pinTab(tab); // Then ensure all the tab open/pinning information is sent. this._fireTabOpen(tab, {}); @@ -481,7 +483,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a let { groupId } = tabData; const tabGroup = tabGroupWorkingData.get(groupId); // if a tab refers to a tab group we don't know, skip any group -@@ -4564,7 +4705,10 @@ +@@ -4564,7 +4707,10 @@ tabGroup.stateData.id, tabGroup.stateData.color, tabGroup.stateData.collapsed, @@ -493,7 +495,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a ); tabsFragment.appendChild(tabGroup.node); } -@@ -4619,9 +4763,21 @@ +@@ -4619,9 +4765,21 @@ // to remove the old selected tab. if (tabToSelect) { let leftoverTab = this.selectedTab; @@ -515,7 +517,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a if (tabs.length > 1 || !tabs[0].selected) { this._updateTabsAfterInsert(); -@@ -4812,11 +4968,14 @@ +@@ -4812,11 +4970,14 @@ if (ownerTab) { tab.owner = ownerTab; } @@ -531,7 +533,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a if ( !bulkOrderedOpen && ((openerTab && -@@ -4828,7 +4987,7 @@ +@@ -4828,7 +4989,7 @@ let lastRelatedTab = openerTab && this._lastRelatedTabMap.get(openerTab); let previousTab = lastRelatedTab || openerTab || this.selectedTab; @@ -540,7 +542,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a tabGroup = previousTab.group; } if ( -@@ -4844,7 +5003,7 @@ +@@ -4844,7 +5005,7 @@ previousTab.splitview ) + 1; } else if (previousTab.visible) { @@ -549,7 +551,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a } else if (previousTab == FirefoxViewHandler.tab) { elementIndex = 0; } -@@ -4872,14 +5031,14 @@ +@@ -4872,14 +5033,14 @@ } // Ensure index is within bounds. if (tab.pinned) { @@ -568,7 +570,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a if (pinned && !itemAfter?.pinned) { itemAfter = null; -@@ -4896,7 +5055,7 @@ +@@ -4896,7 +5057,7 @@ this.tabContainer._invalidateCachedTabs(); @@ -577,7 +579,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a if ( (this.isTab(itemAfter) && itemAfter.group == tabGroup) || this.isSplitViewWrapper(itemAfter) -@@ -4927,7 +5086,11 @@ +@@ -4927,7 +5088,11 @@ const tabContainer = pinned ? this.tabContainer.pinnedTabsContainer : this.tabContainer; @@ -589,7 +591,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a } if (tab.group?.collapsed) { -@@ -4942,6 +5105,7 @@ +@@ -4942,6 +5107,7 @@ if (pinned) { this._updateTabBarForPinnedTabs(); } @@ -597,7 +599,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a TabBarVisibility.update(); } -@@ -5490,6 +5654,7 @@ +@@ -5490,6 +5656,7 @@ telemetrySource, } = {} ) { @@ -605,7 +607,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a // When 'closeWindowWithLastTab' pref is enabled, closing all tabs // can be considered equivalent to closing the window. if ( -@@ -5579,6 +5744,7 @@ +@@ -5579,6 +5746,7 @@ if (lastToClose) { this.removeTab(lastToClose, aParams); } @@ -613,7 +615,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a } catch (e) { console.error(e); } -@@ -5624,6 +5790,14 @@ +@@ -5624,6 +5792,14 @@ return; } @@ -628,7 +630,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a 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 -@@ -5631,6 +5805,9 @@ +@@ -5631,6 +5807,9 @@ // state). let tabWidth = window.windowUtils.getBoundsWithoutFlushing(aTab).width; let isLastTab = this.#isLastTabInWindow(aTab); @@ -638,7 +640,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a if ( !this._beginRemoveTab(aTab, { closeWindowFastpath: true, -@@ -5642,13 +5819,14 @@ +@@ -5642,13 +5821,14 @@ telemetrySource, }) ) { @@ -654,7 +656,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a let lockTabSizing = !this.tabContainer.verticalMode && !aTab.pinned && -@@ -5679,7 +5857,13 @@ +@@ -5679,7 +5859,13 @@ // We're not animating, so we can cancel the animation stopwatch. Glean.browserTabclose.timeAnim.cancel(aTab._closeTimeAnimTimerId); aTab._closeTimeAnimTimerId = null; @@ -669,7 +671,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a return; } -@@ -5813,7 +5997,7 @@ +@@ -5813,7 +5999,7 @@ closeWindowWithLastTab != null ? closeWindowWithLastTab : !window.toolbar.visible || @@ -678,7 +680,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a if (closeWindow) { // We've already called beforeunload on all the relevant tabs if we get here, -@@ -5837,6 +6021,7 @@ +@@ -5837,6 +6023,7 @@ newTab = true; } @@ -686,7 +688,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a aTab._endRemoveArgs = [closeWindow, newTab]; // swapBrowsersAndCloseOther will take care of closing the window without animation. -@@ -5877,13 +6062,7 @@ +@@ -5877,13 +6064,7 @@ aTab._mouseleave(); if (newTab) { @@ -701,7 +703,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a } else { TabBarVisibility.update(); } -@@ -6016,6 +6195,7 @@ +@@ -6016,6 +6197,7 @@ this.tabs[i]._tPos = i; } @@ -709,7 +711,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a if (!this._windowIsClosing) { // update tab close buttons state this.tabContainer._updateCloseButtons(); -@@ -6201,6 +6381,7 @@ +@@ -6201,6 +6383,7 @@ memory_after: await getTotalMemoryUsage(), time_to_unload_in_ms: timeElapsed, }); @@ -717,7 +719,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a } /** -@@ -6246,6 +6427,7 @@ +@@ -6246,6 +6429,7 @@ } let excludeTabs = new Set(aExcludeTabs); @@ -725,7 +727,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a // If this tab has a successor, it should be selectable, since // hiding or closing a tab removes that tab as a successor. -@@ -6258,15 +6440,22 @@ +@@ -6258,15 +6442,22 @@ !excludeTabs.has(aTab.owner) && Services.prefs.getBoolPref("browser.tabs.selectOwnerOnClose") ) { @@ -750,7 +752,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a let tab = this.tabContainer.findNextTab(aTab, { direction: 1, filter: _tab => remainingTabs.includes(_tab), -@@ -6280,7 +6469,7 @@ +@@ -6280,7 +6471,7 @@ } if (tab) { @@ -759,7 +761,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a } // If no qualifying visible tab was found, see if there is a tab in -@@ -6301,7 +6490,7 @@ +@@ -6301,7 +6492,7 @@ }); } @@ -768,7 +770,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a } _blurTab(aTab) { -@@ -6312,7 +6501,7 @@ +@@ -6312,7 +6503,7 @@ * @returns {boolean} * False if swapping isn't permitted, true otherwise. */ @@ -777,7 +779,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a // Do not allow transfering a private tab to a non-private window // and vice versa. if ( -@@ -6366,6 +6555,7 @@ +@@ -6366,6 +6557,7 @@ // fire the beforeunload event in the process. Close the other // window if this was its last tab. if ( @@ -785,7 +787,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a !remoteBrowser._beginRemoveTab(aOtherTab, { adoptedByTab: aOurTab, closeWindowWithLastTab: true, -@@ -6377,7 +6567,7 @@ +@@ -6377,7 +6569,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. @@ -794,7 +796,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a if (closeWindow) { let win = aOtherTab.ownerGlobal; win.windowUtils.suppressAnimation(true); -@@ -6511,11 +6701,13 @@ +@@ -6511,11 +6703,13 @@ } // Finish tearing down the tab that's going away. @@ -808,7 +810,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a this.setTabTitle(aOurTab); -@@ -6717,10 +6909,10 @@ +@@ -6717,10 +6911,10 @@ SessionStore.deleteCustomTabValue(aTab, "hiddenBy"); } @@ -821,7 +823,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a aTab.selected || aTab.closing || // Tabs that are sharing the screen, microphone or camera cannot be hidden. -@@ -6780,7 +6972,8 @@ +@@ -6780,7 +6974,8 @@ * @param {object} [aOptions={}] * Key-value pairs that will be serialized into the features string. */ @@ -831,7 +833,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a if (this.tabs.length == 1) { return null; } -@@ -6797,7 +6990,7 @@ +@@ -6797,7 +6992,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); @@ -840,7 +842,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a private: PrivateBrowsingUtils.isWindowPrivate(window), features: Object.entries(aOptions) .map(([key, value]) => `${key}=${value}`) -@@ -6805,6 +6998,8 @@ +@@ -6805,6 +7000,8 @@ openerWindow: window, args, }); @@ -849,7 +851,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a } /** -@@ -6917,7 +7112,7 @@ +@@ -6917,7 +7114,7 @@ * `true` if element is a `` */ isTabGroup(element) { @@ -858,7 +860,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a } /** -@@ -7002,8 +7197,8 @@ +@@ -7002,8 +7199,8 @@ } // Don't allow mixing pinned and unpinned tabs. @@ -869,7 +871,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a } else { tabIndex = Math.max(tabIndex, this.pinnedTabCount); } -@@ -7049,8 +7244,8 @@ +@@ -7049,8 +7246,8 @@ this.#handleTabMove( element, () => { @@ -880,7 +882,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a neighbor = neighbor.group; } if (neighbor?.splitview) { -@@ -7061,6 +7256,12 @@ +@@ -7061,6 +7258,12 @@ return; } } @@ -893,7 +895,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a if (movingForwards && neighbor) { neighbor.after(element); -@@ -7119,23 +7320,31 @@ +@@ -7119,23 +7322,31 @@ #moveTabNextTo(element, targetElement, moveBefore = false, metricsContext) { if (this.isTabGroupLabel(targetElement)) { targetElement = targetElement.group; @@ -931,7 +933,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a } 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 -@@ -7148,12 +7357,35 @@ +@@ -7148,12 +7359,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. @@ -968,7 +970,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a // 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. -@@ -7162,6 +7394,7 @@ +@@ -7162,6 +7396,7 @@ } let getContainer = () => @@ -976,7 +978,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a element.pinned ? this.tabContainer.pinnedTabsContainer : this.tabContainer; -@@ -7170,11 +7403,15 @@ +@@ -7170,11 +7405,15 @@ element, () => { if (moveBefore) { @@ -993,7 +995,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a } }, metricsContext -@@ -7248,11 +7485,15 @@ +@@ -7248,11 +7487,15 @@ * @param {TabMetricsContext} [metricsContext] */ moveTabToExistingGroup(aTab, aGroup, metricsContext) { @@ -1012,7 +1014,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a } if (aTab.group && aTab.group.id === aGroup.id) { return; -@@ -7324,6 +7565,7 @@ +@@ -7324,6 +7567,7 @@ let state = { tabIndex: tab._tPos, @@ -1020,7 +1022,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a }; if (tab.visible) { state.elementIndex = tab.elementIndex; -@@ -7355,7 +7597,7 @@ +@@ -7355,7 +7599,7 @@ let changedSplitView = previousTabState.splitViewId != currentTabState.splitViewId; @@ -1029,7 +1031,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a tab.dispatchEvent( new CustomEvent("TabMove", { bubbles: true, -@@ -7402,6 +7644,10 @@ +@@ -7402,6 +7646,10 @@ moveActionCallback(); @@ -1040,7 +1042,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a // Clear tabs cache after moving nodes because the order of tabs may have // changed. this.tabContainer._invalidateCachedTabs(); -@@ -7452,7 +7698,22 @@ +@@ -7452,7 +7700,22 @@ * @returns {object} * The new tab in the current window, null if the tab couldn't be adopted. */ @@ -1064,7 +1066,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a // 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 -@@ -7495,6 +7756,8 @@ +@@ -7495,6 +7758,8 @@ } params.skipLoad = true; let newTab = this.addWebTab("about:blank", params); @@ -1073,7 +1075,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a aTab.container.tabDragAndDrop.finishAnimateTabMove(); -@@ -8205,7 +8468,7 @@ +@@ -8205,7 +8470,7 @@ // preventDefault(). It will still raise the window if appropriate. return; } @@ -1082,7 +1084,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a window.focus(); aEvent.preventDefault(); } -@@ -8222,7 +8485,6 @@ +@@ -8222,7 +8487,6 @@ on_TabGroupCollapse(aEvent) { aEvent.target.tabs.forEach(tab => { @@ -1090,7 +1092,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a }); } -@@ -8556,7 +8818,9 @@ +@@ -8556,7 +8820,9 @@ let filter = this._tabFilters.get(tab); if (filter) { @@ -1100,7 +1102,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a let listener = this._tabListeners.get(tab); if (listener) { -@@ -9359,6 +9623,7 @@ +@@ -9359,6 +9625,7 @@ aWebProgress.isTopLevel ) { this.mTab.setAttribute("busy", "true"); @@ -1108,7 +1110,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a gBrowser._tabAttrModified(this.mTab, ["busy"]); this.mTab._notselectedsinceload = !this.mTab.selected; } -@@ -9439,6 +9704,7 @@ +@@ -9439,6 +9706,7 @@ // known defaults. Note we use the original URL since about:newtab // redirects to a prerendered page. const shouldRemoveFavicon = @@ -1116,7 +1118,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a !this.mBrowser.mIconURL && !ignoreBlank && !(originalLocation.spec in FAVICON_DEFAULTS); -@@ -9613,13 +9879,6 @@ +@@ -9613,13 +9881,6 @@ this.mBrowser.originalURI = aRequest.originalURI; } @@ -1130,7 +1132,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..028dfcba9e23a17e4152071dd58eb97a } let userContextId = this.mBrowser.getAttribute("usercontextid") || 0; -@@ -10507,7 +10766,8 @@ var TabContextMenu = { +@@ -10507,7 +10768,8 @@ var TabContextMenu = { ); contextUnpinSelectedTabs.hidden = !this.contextTab.pinned || !this.multiselected; diff --git a/src/zen/spaces/ZenSpaceManager.mjs b/src/zen/spaces/ZenSpaceManager.mjs index cfb60c004..5f2f403f1 100644 --- a/src/zen/spaces/ZenSpaceManager.mjs +++ b/src/zen/spaces/ZenSpaceManager.mjs @@ -2297,8 +2297,14 @@ class nsZenWorkspaces { !aTab.hasAttribute("zen-empty-tab") && !aTab.hasAttribute("zen-essential") ) { - this.changeWorkspaceWithID(tabSpace); + this.changeWorkspaceWithID(tabSpace) + .catch(console.error) + .then(() => { + gBrowser.selectedTab = aTab; + }); + return true; } + return false; } _shouldShowTab(tab, workspaceUuid, containerId, workspaces) { diff --git a/src/zen/urlbar/ZenSiteDataPanel.sys.mjs b/src/zen/urlbar/ZenSiteDataPanel.sys.mjs index 90e037b09..f781f134f 100644 --- a/src/zen/urlbar/ZenSiteDataPanel.sys.mjs +++ b/src/zen/urlbar/ZenSiteDataPanel.sys.mjs @@ -142,7 +142,9 @@ export class nsZenSiteDataPanel { this.anchor.removeAttribute("boosting"); } // Force a reflow to ensure the attribute change is applied before any potential animation. - this.anchor.getBoundingClientRect(); + if (this.unifiedPanel.state === "open") { + this.anchor.getBoundingClientRect(); + } } #initCopyUrlButton() { diff --git a/surfer.json b/surfer.json index bcc52e5b1..dab8b73a6 100644 --- a/surfer.json +++ b/surfer.json @@ -20,7 +20,7 @@ "brandShortName": "Zen", "brandFullName": "Zen Browser", "release": { - "displayVersion": "1.21b", + "displayVersion": "1.21.1b", "github": { "repo": "zen-browser/desktop" }, From 7bf236fcf417aeaa4f65e42b48d063a27cabf2c6 Mon Sep 17 00:00:00 2001 From: "mr. m" <91018726+mr-cheffy@users.noreply.github.com> Date: Fri, 12 Jun 2026 00:20:53 +0200 Subject: [PATCH 3/8] gh-14117: Fixed incorrect tab routing container checks (gh-14128) --- .../tabbrowser/content/tabbrowser-js.patch | 4 ++-- src/zen/spaces/ZenSpaceManager.mjs | 13 ++++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/browser/components/tabbrowser/content/tabbrowser-js.patch b/src/browser/components/tabbrowser/content/tabbrowser-js.patch index 0edeeb8d7..7c8a6bf53 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 43fb79a3060e20f671ae6ffc26350c7abf497702..f4a5daa70374bbf7b3f42a6023b346dccad2a0be 100644 +index 43fb79a3060e20f671ae6ffc26350c7abf497702..68a037d5a0e3416f31ffcb163592f008ede72076 100644 --- a/browser/components/tabbrowser/content/tabbrowser.js +++ b/browser/components/tabbrowser/content/tabbrowser.js @@ -502,6 +502,7 @@ @@ -296,7 +296,7 @@ index 43fb79a3060e20f671ae6ffc26350c7abf497702..f4a5daa70374bbf7b3f42a6023b346dc + + let hasZenDefaultUserContextId = false; + let zenForcedWorkspaceId = undefined; -+ if (beforeRouteResult.userContextId) { ++ if (beforeRouteResult.isRouteFound) { + userContextId = beforeRouteResult.userContextId; + hasZenDefaultUserContextId = true; + } else if (typeof gZenWorkspaces !== "undefined" && !_forZenEmptyTab) { diff --git a/src/zen/spaces/ZenSpaceManager.mjs b/src/zen/spaces/ZenSpaceManager.mjs index 5f2f403f1..928d634dc 100644 --- a/src/zen/spaces/ZenSpaceManager.mjs +++ b/src/zen/spaces/ZenSpaceManager.mjs @@ -2290,6 +2290,11 @@ class nsZenWorkspaces { } onBeforeTabSelect(aTab) { + if (this.#inChangingWorkspace) { + // Just in case, Let's not do these checks while we are + // in the middle of changing workspace, + return false; + } const tabSpace = aTab?.getAttribute("zen-workspace-id"); if ( tabSpace && @@ -2297,11 +2302,9 @@ class nsZenWorkspaces { !aTab.hasAttribute("zen-empty-tab") && !aTab.hasAttribute("zen-essential") ) { - this.changeWorkspaceWithID(tabSpace) - .catch(console.error) - .then(() => { - gBrowser.selectedTab = aTab; - }); + this.lastSelectedWorkspaceTabs[tabSpace] = + gZenGlanceManager.getTabOrGlanceParent(aTab); + this.changeWorkspaceWithID(tabSpace); return true; } return false; From 6bc560c8766a64197695c54a9789acee92c76f4e Mon Sep 17 00:00:00 2001 From: "mr. m" <91018726+mr-cheffy@users.noreply.github.com> Date: Fri, 12 Jun 2026 08:43:29 +0200 Subject: [PATCH 4/8] gh-14135: Fixed intermitent build errors for macos (gh-14136) --- .github/workflows/macos-universal-release-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/macos-universal-release-build.yml b/.github/workflows/macos-universal-release-build.yml index b4fea39a0..762a92a6d 100644 --- a/.github/workflows/macos-universal-release-build.yml +++ b/.github/workflows/macos-universal-release-build.yml @@ -60,7 +60,7 @@ jobs: brew install watchman - cargo install apple-codesign + cargo install apple-codesign --locked --force - name: Force usage of gnu-tar run: | From 8b0aab15b5d279b30daf1eb974e8fe09ec8289f6 Mon Sep 17 00:00:00 2001 From: Ashvin Jangid <142579833+ashvwinn@users.noreply.github.com> Date: Fri, 12 Jun 2026 17:20:10 +0530 Subject: [PATCH 5/8] gh-14145: fix boosts size and case overrides not working on first time press (gh-14147) --- src/zen/boosts/ZenBoostsEditor.mjs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/zen/boosts/ZenBoostsEditor.mjs b/src/zen/boosts/ZenBoostsEditor.mjs index b74964fca..b120ef25e 100644 --- a/src/zen/boosts/ZenBoostsEditor.mjs +++ b/src/zen/boosts/ZenBoostsEditor.mjs @@ -630,6 +630,7 @@ ${cssSelector} { this.currentBoostData.textCaseOverride = "uppercase"; } + this.currentBoostData.changeWasMade = true; this.updateCaseButtonVisuals(); this.updateCurrentBoost(); } @@ -651,6 +652,7 @@ ${cssSelector} { await this.zenBoostsChild.sendQuery("ZenBoost:DisableSizeOverride"); } + this.currentBoostData.changeWasMade = true; this.updateSizeButtonVisuals(); this.updateCurrentBoost(); } From 3773e66e3c2a8fbc6b4c2a46d3c11322154dd5fa Mon Sep 17 00:00:00 2001 From: Ashvin Jangid <142579833+ashvwinn@users.noreply.github.com> Date: Sat, 13 Jun 2026 14:21:34 +0530 Subject: [PATCH 6/8] gh-14020: dynamically switch boosts window theme (gh-14156) fixes: #14020 --- src/zen/boosts/ZenBoostsEditor.mjs | 32 ++++++++++++++++--------- src/zen/spaces/ZenGradientGenerator.mjs | 1 + 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/zen/boosts/ZenBoostsEditor.mjs b/src/zen/boosts/ZenBoostsEditor.mjs index b120ef25e..f67ad0fa3 100644 --- a/src/zen/boosts/ZenBoostsEditor.mjs +++ b/src/zen/boosts/ZenBoostsEditor.mjs @@ -18,6 +18,7 @@ export class nsZenBoostEditor { "zap-state-update", "selector-picker-state-update", "zen-boosts-active-change", + "zen-theme-change", ]; /** @@ -44,7 +45,6 @@ export class nsZenBoostEditor { this.lastDotSetPos = { x: 0, y: 0 }; this.currentBoostData = null; this.boostInfo = null; - this.isDarkMode = this.openerWindow.gZenThemePicker.isDarkMode; this.killOtherEditorInstances(); @@ -53,10 +53,14 @@ export class nsZenBoostEditor { }); this.init(); - this.initColorScheme(); this.initColorPicker(); this.initFonts(); this.loadBoost(domain); + this.updateColorScheme(); + } + + get isDarkMode() { + return this.openerWindow.gZenThemePicker.isDarkMode; } /** @@ -195,17 +199,24 @@ export class nsZenBoostEditor { case "zen-boosts-active-change": this.editorWindow.close(); break; + case "zen-theme-change": + this.updateColorScheme(); + break; } } /** - * Initializes the color scheme of the editor window based on the current theme (dark or light mode) + * Updates the color scheme of the editor window based on the current theme (dark or light mode) */ - initColorScheme() { - if (this.isDarkMode) { - this.doc.documentElement.style.colorScheme = "dark"; - } else { - this.doc.documentElement.style.colorScheme = "light"; + updateColorScheme() { + const colorScheme = this.isDarkMode ? "dark" : "light"; + this.doc.documentElement.style.colorScheme = colorScheme; + + if (this.codeEditorReady) { + const container = this.doc.getElementById("zen-boost-code-editor"); + const editorEl = + container.querySelector("iframe").contentDocument.documentElement; + editorEl.className = "theme-" + colorScheme; } } @@ -239,11 +250,10 @@ export class nsZenBoostEditor { editor.refresh(); editor.on("change", this.onCodeEditorChange.bind(this)); - const editorEl = - container.querySelector("iframe").contentDocument.documentElement; - editorEl.className = "theme-" + (this.isDarkMode ? "dark" : "light"); this.editorWindow._editor = editor; this.codeEditorReady = true; + + this.updateColorScheme(); } /** diff --git a/src/zen/spaces/ZenGradientGenerator.mjs b/src/zen/spaces/ZenGradientGenerator.mjs index f93df4bdf..b73266457 100644 --- a/src/zen/spaces/ZenGradientGenerator.mjs +++ b/src/zen/spaces/ZenGradientGenerator.mjs @@ -177,6 +177,7 @@ export class nsZenThemePicker extends nsZenMultiWindowFeature { handleDarkModeChange() { this.updateCurrentWorkspace(); + Services.obs.notifyObservers(null, "zen-theme-change"); } get isDarkMode() { From 4313bc8aa4880f4e6bf2414b48722a62073ffb67 Mon Sep 17 00:00:00 2001 From: Gaylord Julien Date: Sat, 13 Jun 2026 10:55:53 +0200 Subject: [PATCH 7/8] gh-14127: Fix search bar emptied after search engine selection (gh-14153) fix #14127 --- src/browser/components/urlbar/content/UrlbarInput-mjs.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/browser/components/urlbar/content/UrlbarInput-mjs.patch b/src/browser/components/urlbar/content/UrlbarInput-mjs.patch index 43314bcc0..1b36d9852 100644 --- a/src/browser/components/urlbar/content/UrlbarInput-mjs.patch +++ b/src/browser/components/urlbar/content/UrlbarInput-mjs.patch @@ -138,7 +138,7 @@ index d6615ec5a29f3e3327ac4171f3fc5d9a69bd09fe..c166b7de23c35716bf8c51b6b9c72f77 + if (this._zenHandleUrlbarClose) { + this._zenHandleUrlbarClose(); -+ } else if (!this._untrimmedValue || this.searchMode || this.window.gZenVerticalTabsManager._hasSetSingleToolbar) { ++ } else if (!this._untrimmedValue || (this.#isAddressbar && (this.searchMode || this.window.gZenVerticalTabsManager._hasSetSingleToolbar))) { + // Restore the current page URL when the urlbar is empty on blur + this.window.requestAnimationFrame(() => { + this.handleRevert(); From 4cb4de265669dc312206ccda906d166443457700 Mon Sep 17 00:00:00 2001 From: Bibhav Adhikari Date: Sat, 13 Jun 2026 07:24:41 -0500 Subject: [PATCH 8/8] gh-8391: Prevent opening glance when selecting text in link (gh-14164) --- src/zen/glance/actors/ZenGlanceChild.sys.mjs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/zen/glance/actors/ZenGlanceChild.sys.mjs b/src/zen/glance/actors/ZenGlanceChild.sys.mjs index 10d9fff14..f31b83e61 100644 --- a/src/zen/glance/actors/ZenGlanceChild.sys.mjs +++ b/src/zen/glance/actors/ZenGlanceChild.sys.mjs @@ -17,8 +17,14 @@ XPCOMUtils.defineLazyPreferenceGetter( true ); +// A small threshold to allow for minor mouse jitter during a normal click. +// Anything beyond this is likely an intentional drag (like selecting text). +const CLICK_DRAG_THRESHOLD_PX = 4; + export class ZenGlanceChild extends JSWindowActorChild { #activationMethod; + #mouseDownX = null; + #mouseDownY = null; constructor() { super(); @@ -121,9 +127,23 @@ export class ZenGlanceChild extends JSWindowActorChild { // The problem is that at that stage we don't know the rect or even what // element has been clicked, so we send the data here. this.#sendClickDataToParent(node, event.target); + + this.#mouseDownX = event.clientX; + this.#mouseDownY = event.clientY; } on_click(event) { + // If the user drags to select text inside a link, we shouldn't open glance. + if (this.#mouseDownX !== null && this.#mouseDownY !== null) { + const deltaX = Math.abs(event.clientX - this.#mouseDownX); + const deltaY = Math.abs(event.clientY - this.#mouseDownY); + this.#mouseDownX = null; + this.#mouseDownY = null; + if (deltaX > CLICK_DRAG_THRESHOLD_PX || deltaY > CLICK_DRAG_THRESHOLD_PX) { + return; + } + } + const { node, href, principal } = this.#getTargetFromEvent(event); if ( event.button !== 0 ||