diff --git a/src/browser/components/tabbrowser/content/tabbrowser-js.patch b/src/browser/components/tabbrowser/content/tabbrowser-js.patch index 0950c539d..01fab47d2 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 42027bfa55eab8ea9298a7d425f2ded45188f7f3..9a619171c7f1f7ba43c2c661bdad370f83733bf0 100644 +index 42027bfa55eab8ea9298a7d425f2ded45188f7f3..f6ac8df9fdd064ffec7f4290b4a85755693d9bdb 100644 --- a/browser/components/tabbrowser/content/tabbrowser.js +++ b/browser/components/tabbrowser/content/tabbrowser.js @@ -386,6 +386,7 @@ @@ -725,17 +725,23 @@ index 42027bfa55eab8ea9298a7d425f2ded45188f7f3..9a619171c7f1f7ba43c2c661bdad370f if (this.tabs.length == 1) { return null; } -@@ -6213,7 +6372,8 @@ +@@ -6209,12 +6368,14 @@ + } + + // tell a new window to take the "dropped" tab +- return window.openDialog( ++ let win = window.openDialog( AppConstants.BROWSER_CHROME_URL, "_blank", options, -- aTab -+ aTab, -+ zenForceSync ? "zen-synced" : "zen-unsynced" + aTab ); ++ win._zenStartupSyncFlag = zenForceSync ? 'synced' : 'unsynced'; ++ return win; } -@@ -6319,7 +6479,7 @@ + /** +@@ -6319,7 +6480,7 @@ * `true` if element is a `` */ isTabGroup(element) { @@ -744,7 +750,7 @@ index 42027bfa55eab8ea9298a7d425f2ded45188f7f3..9a619171c7f1f7ba43c2c661bdad370f } /** -@@ -6404,8 +6564,8 @@ +@@ -6404,8 +6565,8 @@ } // Don't allow mixing pinned and unpinned tabs. @@ -755,7 +761,7 @@ index 42027bfa55eab8ea9298a7d425f2ded45188f7f3..9a619171c7f1f7ba43c2c661bdad370f } else { tabIndex = Math.max(tabIndex, this.pinnedTabCount); } -@@ -6431,10 +6591,16 @@ +@@ -6431,10 +6592,16 @@ this.#handleTabMove( element, () => { @@ -774,7 +780,7 @@ index 42027bfa55eab8ea9298a7d425f2ded45188f7f3..9a619171c7f1f7ba43c2c661bdad370f if (neighbor && this.isTab(element) && tabIndex > element._tPos) { neighbor.after(element); } else { -@@ -6492,23 +6658,28 @@ +@@ -6492,23 +6659,28 @@ #moveTabNextTo(element, targetElement, moveBefore = false, metricsContext) { if (this.isTabGroupLabel(targetElement)) { targetElement = targetElement.group; @@ -809,7 +815,7 @@ index 42027bfa55eab8ea9298a7d425f2ded45188f7f3..9a619171c7f1f7ba43c2c661bdad370f } 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 -@@ -6521,14 +6692,34 @@ +@@ -6521,14 +6693,34 @@ // 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. @@ -845,7 +851,7 @@ index 42027bfa55eab8ea9298a7d425f2ded45188f7f3..9a619171c7f1f7ba43c2c661bdad370f element.pinned ? this.tabContainer.pinnedTabsContainer : this.tabContainer; -@@ -6537,7 +6728,7 @@ +@@ -6537,7 +6729,7 @@ element, () => { if (moveBefore) { @@ -854,7 +860,7 @@ index 42027bfa55eab8ea9298a7d425f2ded45188f7f3..9a619171c7f1f7ba43c2c661bdad370f } else if (targetElement) { targetElement.after(element); } else { -@@ -6607,10 +6798,10 @@ +@@ -6607,10 +6799,10 @@ * @param {TabMetricsContext} [metricsContext] */ moveTabToGroup(aTab, aGroup, metricsContext) { @@ -867,7 +873,7 @@ index 42027bfa55eab8ea9298a7d425f2ded45188f7f3..9a619171c7f1f7ba43c2c661bdad370f return; } if (aTab.group && aTab.group.id === aGroup.id) { -@@ -6656,6 +6847,7 @@ +@@ -6656,6 +6848,7 @@ let state = { tabIndex: tab._tPos, @@ -875,7 +881,7 @@ index 42027bfa55eab8ea9298a7d425f2ded45188f7f3..9a619171c7f1f7ba43c2c661bdad370f }; if (tab.visible) { state.elementIndex = tab.elementIndex; -@@ -6682,7 +6874,7 @@ +@@ -6682,7 +6875,7 @@ let changedTabGroup = previousTabState.tabGroupId != currentTabState.tabGroupId; @@ -884,7 +890,7 @@ index 42027bfa55eab8ea9298a7d425f2ded45188f7f3..9a619171c7f1f7ba43c2c661bdad370f tab.dispatchEvent( new CustomEvent("TabMove", { bubbles: true, -@@ -6723,6 +6915,10 @@ +@@ -6723,6 +6916,10 @@ moveActionCallback(); @@ -895,7 +901,7 @@ index 42027bfa55eab8ea9298a7d425f2ded45188f7f3..9a619171c7f1f7ba43c2c661bdad370f // Clear tabs cache after moving nodes because the order of tabs may have // changed. this.tabContainer._invalidateCachedTabs(); -@@ -7623,7 +7819,7 @@ +@@ -7623,7 +7820,7 @@ // preventDefault(). It will still raise the window if appropriate. break; } @@ -904,7 +910,7 @@ index 42027bfa55eab8ea9298a7d425f2ded45188f7f3..9a619171c7f1f7ba43c2c661bdad370f window.focus(); aEvent.preventDefault(); break; -@@ -7640,7 +7836,6 @@ +@@ -7640,7 +7837,6 @@ } case "TabGroupCollapse": aEvent.target.tabs.forEach(tab => { @@ -912,7 +918,7 @@ index 42027bfa55eab8ea9298a7d425f2ded45188f7f3..9a619171c7f1f7ba43c2c661bdad370f }); break; case "TabGroupCreateByUser": -@@ -8589,6 +8784,7 @@ +@@ -8589,6 +8785,7 @@ aWebProgress.isTopLevel ) { this.mTab.setAttribute("busy", "true"); @@ -920,7 +926,7 @@ index 42027bfa55eab8ea9298a7d425f2ded45188f7f3..9a619171c7f1f7ba43c2c661bdad370f gBrowser._tabAttrModified(this.mTab, ["busy"]); this.mTab._notselectedsinceload = !this.mTab.selected; } -@@ -9623,7 +9819,7 @@ var TabContextMenu = { +@@ -9623,7 +9820,7 @@ var TabContextMenu = { ); contextUnpinSelectedTabs.hidden = !this.contextTab.pinned || !this.multiselected; diff --git a/src/zen/sessionstore/ZenWindowSync.sys.mjs b/src/zen/sessionstore/ZenWindowSync.sys.mjs index 08eddfd32..f5054b6a3 100644 --- a/src/zen/sessionstore/ZenWindowSync.sys.mjs +++ b/src/zen/sessionstore/ZenWindowSync.sys.mjs @@ -54,8 +54,8 @@ class nsZenWindowSync { * Context about the currently handled event. * Used to avoid re-entrancy issues. * - * We do still wan't to keep a stack of these in order - * to handle consequtive events properly. For example, + * We do still want to keep a stack of these in order + * to handle consecutive events properly. For example, * loading a webpage will call IconChanged and TitleChanged * events one after another. */ @@ -137,13 +137,12 @@ class nsZenWindowSync { // windows already exist let forcedSync = false; let hasUnsyncedArg = false; - for (let arg of aWindow.arguments) { - if (arg === 'zen-synced') { - forcedSync = true; - } else if (arg === 'zen-unsynced') { - hasUnsyncedArg = true; - } + if (aWindow._zenStartupSyncFlag === 'synced') { + forcedSync = true; + } else if (aWindow._zenStartupSyncFlag === 'unsynced') { + hasUnsyncedArg = true; } + delete aWindow._zenStartupSyncFlag; if ( !forcedSync && (hasUnsyncedArg || @@ -518,14 +517,14 @@ class nsZenWindowSync { } if (focus) { // Recalculate the focus in order to allow the user to continue typing - // inside the web contentx area without having to click outside and back in. + // inside the web content area without having to click outside and back in. aOurTab.linkedBrowser.blur(); aOurTab.ownerGlobal.gBrowser._adjustFocusAfterTabSwitch(aOurTab); } // Ensure the tab's state is flushed after the swap. By doing this, // we can re-schedule another session store delayed process to fire. // It's also important to note that if we don't flush the state here, - // we would start recieving invalid history changes from the the incorrect + // we would start receiving invalid history changes from the the incorrect // browser view that was just swapped out. lazy.TabStateFlusher.flush(aOurTab.linkedBrowser); } @@ -863,9 +862,9 @@ class nsZenWindowSync { on_TabGroupCreate(aEvent) { const tabGroup = aEvent.target; - if (tabGroup.id) { + if (tabGroup.id && tabGroup.alreadySynced) { // This tab group was opened as part of a sync operation. - console.log('Duplicate!'); + return; } const window = tabGroup.ownerGlobal; const isFolder = tabGroup.isZenFolder; @@ -876,6 +875,7 @@ class nsZenWindowSync { ? win.gZenFolders.createFolder([], {}) : win.gBrowser.addTabGroup({ splitView: isSplitView }); newGroup.id = tabGroup.id; + newGroup.alreadySynced = true; this.#syncItemWithOriginal( tabGroup, newGroup, diff --git a/src/zen/tabs/ZenPinnedTabManager.mjs b/src/zen/tabs/ZenPinnedTabManager.mjs index 3ef23aab1..820dc161d 100644 --- a/src/zen/tabs/ZenPinnedTabManager.mjs +++ b/src/zen/tabs/ZenPinnedTabManager.mjs @@ -90,9 +90,6 @@ class nsZenPinnedTabManager extends nsZenDOMOperatedFeature { const iconUrl = url ?? tab.iconImage.src; if (tab.hasAttribute('zen-essential')) { tab.style.setProperty('--zen-essential-tab-icon', `url(${iconUrl})`); - if (tab.hasAttribute('zen-essential')) { - tab.style.setProperty('--zen-essential-tab-icon', `url(${iconUrl})`); - } } } diff --git a/src/zen/workspaces/ZenWorkspaces.mjs b/src/zen/workspaces/ZenWorkspaces.mjs index 99ec1e86e..07f35da4b 100644 --- a/src/zen/workspaces/ZenWorkspaces.mjs +++ b/src/zen/workspaces/ZenWorkspaces.mjs @@ -837,7 +837,11 @@ class nsZenWorkspaces extends nsZenMultiWindowFeature { } get currentWindowIsSyncing() { - return !document.documentElement.hasAttribute('zen-unsynced-window') && !this.isPrivateWindow; + return ( + !document.documentElement.hasAttribute('zen-unsynced-window') && + window._zenStartupSyncFlag !== 'unsynced' && + !this.isPrivateWindow + ); } get privateWindowOrDisabled() {