feat: Added support for opening external links with 'continue where left off' preference enabled, b=(no-bug), c=split-view, tabs, workspaces

This commit is contained in:
Mr. M 2025-05-06 22:36:09 +02:00
parent 27d3b903d3
commit 15b8385e49
No known key found for this signature in database
GPG key ID: 6292C4C8F8652B18
4 changed files with 57 additions and 75 deletions

View file

@ -1,5 +1,5 @@
diff --git a/browser/components/tabbrowser/content/tabbrowser.js b/browser/components/tabbrowser/content/tabbrowser.js diff --git a/browser/components/tabbrowser/content/tabbrowser.js b/browser/components/tabbrowser/content/tabbrowser.js
index 6dece2b9d0462d90a28e75350ce983d87816ef73..2fd408bd7c6c73ee0106fef75a80f2a9c4e105d5 100644 index 6dece2b9d0462d90a28e75350ce983d87816ef73..033816beb907773463a98d79555a0f5ab4072bdb 100644
--- a/browser/components/tabbrowser/content/tabbrowser.js --- a/browser/components/tabbrowser/content/tabbrowser.js
+++ b/browser/components/tabbrowser/content/tabbrowser.js +++ b/browser/components/tabbrowser/content/tabbrowser.js
@@ -415,11 +415,58 @@ @@ -415,11 +415,58 @@
@ -310,39 +310,19 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..2fd408bd7c6c73ee0106fef75a80f2a9
}); });
} }
@@ -3589,6 +3684,27 @@ @@ -3599,7 +3694,7 @@
) { // Add a new tab if needed.
tabWasReused = true; if (!tab) {
tab = this.selectedTab; let createLazyBrowser =
+ if (tabData.zenWorkspace) { - restoreTabsLazily && !select && !tabData.pinned;
+ tab.setAttribute("zen-workspace-id", tabData.zenWorkspace); + restoreTabsLazily && !tabData.pinned;
+ }
+ if (tabData.zenIsEmpty) { let url = "about:blank";
+ tab.setAttribute("zen-empty-tab", "true"); if (tabData.entries?.length) {
+ } @@ -3638,6 +3733,27 @@
+ if (tabData.zenHasStaticLabel) {
+ tab.setAttribute("zen-has-static-label", "true");
+ }
+ if (tabData.zenPinnedId) {
+ tab.setAttribute("zen-pin-id", tabData.zenPinnedId);
+ }
+ if (tabData.zenEssential) {
+ tab.setAttribute("zen-essential", "true");
+ }
+ if (tabData.zenDefaultUserContextId) {
+ tab.setAttribute("zenDefaultUserContextId", "true");
+ }
+ if (tabData.zenPinnedEntry) {
+ tab.setAttribute("zen-pinned-entry", tabData.zenPinnedEntry);
+ }
if (!tabData.pinned) {
this.unpinTab(tab);
} else {
@@ -3637,7 +3753,27 @@
skipLoad: true,
preferredRemoteType, preferredRemoteType,
}); });
-
+ if (tabData.zenWorkspace) { + if (tabData.zenWorkspace) {
+ tab.setAttribute("zen-workspace-id", tabData.zenWorkspace); + tab.setAttribute("zen-workspace-id", tabData.zenWorkspace);
+ } + }
@ -367,7 +347,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..2fd408bd7c6c73ee0106fef75a80f2a9
if (select) { if (select) {
tabToSelect = tab; tabToSelect = tab;
} }
@@ -3661,7 +3797,8 @@ @@ -3661,7 +3777,8 @@
// needs calling: // needs calling:
shouldUpdateForPinnedTabs = true; shouldUpdateForPinnedTabs = true;
} }
@ -377,7 +357,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..2fd408bd7c6c73ee0106fef75a80f2a9
let { groupId } = tabData; let { groupId } = tabData;
const tabGroup = tabGroupWorkingData.get(groupId); const tabGroup = tabGroupWorkingData.get(groupId);
// if a tab refers to a tab group we don't know, skip any group // if a tab refers to a tab group we don't know, skip any group
@@ -3675,7 +3812,10 @@ @@ -3675,7 +3792,10 @@
tabGroup.stateData.id, tabGroup.stateData.id,
tabGroup.stateData.color, tabGroup.stateData.color,
tabGroup.stateData.collapsed, tabGroup.stateData.collapsed,
@ -389,7 +369,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..2fd408bd7c6c73ee0106fef75a80f2a9
); );
tabsFragment.appendChild(tabGroup.node); tabsFragment.appendChild(tabGroup.node);
} }
@@ -3723,8 +3863,13 @@ @@ -3723,8 +3843,13 @@
// to remove the old selected tab. // to remove the old selected tab.
if (tabToSelect) { if (tabToSelect) {
let leftoverTab = this.selectedTab; let leftoverTab = this.selectedTab;
@ -401,11 +381,11 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..2fd408bd7c6c73ee0106fef75a80f2a9
+ } + }
+ } + }
+ else { + else {
+ this.selectedTab._possiblyEmpty = this.selectedTab.isEmpty; // Not needed, but just in case. + ZenWorkspaces._tabToRemoveForEmpty = this.selectedTab;
} }
if (tabs.length > 1 || !tabs[0].selected) { if (tabs.length > 1 || !tabs[0].selected) {
@@ -3912,7 +4057,7 @@ @@ -3912,7 +4037,7 @@
// Ensure we have an index if one was not provided. // Ensure we have an index if one was not provided.
if (typeof index != "number") { if (typeof index != "number") {
// Move the new tab after another tab if needed, to the end otherwise. // Move the new tab after another tab if needed, to the end otherwise.
@ -414,7 +394,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..2fd408bd7c6c73ee0106fef75a80f2a9
if ( if (
!bulkOrderedOpen && !bulkOrderedOpen &&
((openerTab && ((openerTab &&
@@ -3958,18 +4103,18 @@ @@ -3958,18 +4083,18 @@
// Ensure index is within bounds. // Ensure index is within bounds.
if (tab.pinned) { if (tab.pinned) {
@ -437,7 +417,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..2fd408bd7c6c73ee0106fef75a80f2a9
if (this.isTab(itemAfter) && itemAfter.group == tabGroup) { if (this.isTab(itemAfter) && itemAfter.group == tabGroup) {
// Place at the front of, or between tabs in, the same tab group // Place at the front of, or between tabs in, the same tab group
this.tabContainer.insertBefore(tab, itemAfter); this.tabContainer.insertBefore(tab, itemAfter);
@@ -4290,6 +4435,9 @@ @@ -4290,6 +4415,9 @@
return; return;
} }
@ -447,7 +427,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..2fd408bd7c6c73ee0106fef75a80f2a9
this.removeTabs(selectedTabs, { telemetrySource }); this.removeTabs(selectedTabs, { telemetrySource });
} }
@@ -4542,6 +4690,7 @@ @@ -4542,6 +4670,7 @@
telemetrySource, telemetrySource,
} = {} } = {}
) { ) {
@ -455,7 +435,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..2fd408bd7c6c73ee0106fef75a80f2a9
// When 'closeWindowWithLastTab' pref is enabled, closing all tabs // When 'closeWindowWithLastTab' pref is enabled, closing all tabs
// can be considered equivalent to closing the window. // can be considered equivalent to closing the window.
if ( if (
@@ -4626,6 +4775,7 @@ @@ -4626,6 +4755,7 @@
if (lastToClose) { if (lastToClose) {
this.removeTab(lastToClose, aParams); this.removeTab(lastToClose, aParams);
} }
@ -463,7 +443,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..2fd408bd7c6c73ee0106fef75a80f2a9
} catch (e) { } catch (e) {
console.error(e); console.error(e);
} }
@@ -4650,6 +4800,7 @@ @@ -4650,6 +4780,7 @@
telemetrySource, telemetrySource,
} = {} } = {}
) { ) {
@ -471,7 +451,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..2fd408bd7c6c73ee0106fef75a80f2a9
if (UserInteraction.running("browser.tabs.opening", window)) { if (UserInteraction.running("browser.tabs.opening", window)) {
UserInteraction.finish("browser.tabs.opening", window); UserInteraction.finish("browser.tabs.opening", window);
} }
@@ -4663,6 +4814,12 @@ @@ -4663,6 +4794,12 @@
aTab._closeTimeNoAnimTimerId = Glean.browserTabclose.timeNoAnim.start(); aTab._closeTimeNoAnimTimerId = Glean.browserTabclose.timeNoAnim.start();
} }
@ -484,7 +464,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..2fd408bd7c6c73ee0106fef75a80f2a9
// Handle requests for synchronously removing an already // Handle requests for synchronously removing an already
// asynchronously closing tab. // asynchronously closing tab.
if (!animate && aTab.closing) { if (!animate && aTab.closing) {
@@ -4677,7 +4834,9 @@ @@ -4677,7 +4814,9 @@
// frame created for it (for example, by updating the visually selected // frame created for it (for example, by updating the visually selected
// state). // state).
let tabWidth = window.windowUtils.getBoundsWithoutFlushing(aTab).width; let tabWidth = window.windowUtils.getBoundsWithoutFlushing(aTab).width;
@ -495,7 +475,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..2fd408bd7c6c73ee0106fef75a80f2a9
if ( if (
!this._beginRemoveTab(aTab, { !this._beginRemoveTab(aTab, {
closeWindowFastpath: true, closeWindowFastpath: true,
@@ -4840,7 +4999,7 @@ @@ -4840,7 +4979,7 @@
closeWindowWithLastTab != null closeWindowWithLastTab != null
? closeWindowWithLastTab ? closeWindowWithLastTab
: !window.toolbar.visible || : !window.toolbar.visible ||
@ -504,7 +484,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..2fd408bd7c6c73ee0106fef75a80f2a9
if (closeWindow) { if (closeWindow) {
// We've already called beforeunload on all the relevant tabs if we get here, // We've already called beforeunload on all the relevant tabs if we get here,
@@ -4864,6 +5023,7 @@ @@ -4864,6 +5003,7 @@
newTab = true; newTab = true;
} }
@ -512,7 +492,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..2fd408bd7c6c73ee0106fef75a80f2a9
aTab._endRemoveArgs = [closeWindow, newTab]; aTab._endRemoveArgs = [closeWindow, newTab];
// swapBrowsersAndCloseOther will take care of closing the window without animation. // swapBrowsersAndCloseOther will take care of closing the window without animation.
@@ -4903,9 +5063,7 @@ @@ -4903,9 +5043,7 @@
aTab._mouseleave(); aTab._mouseleave();
if (newTab) { if (newTab) {
@ -523,7 +503,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..2fd408bd7c6c73ee0106fef75a80f2a9
} else { } else {
TabBarVisibility.update(); TabBarVisibility.update();
} }
@@ -5034,6 +5192,8 @@ @@ -5034,6 +5172,8 @@
this.tabs[i]._tPos = i; this.tabs[i]._tPos = i;
} }
@ -532,7 +512,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..2fd408bd7c6c73ee0106fef75a80f2a9
if (!this._windowIsClosing) { if (!this._windowIsClosing) {
if (wasPinned) { if (wasPinned) {
this.tabContainer._positionPinnedTabs(); this.tabContainer._positionPinnedTabs();
@@ -5159,8 +5319,8 @@ @@ -5159,8 +5299,8 @@
return closedCount; return closedCount;
} }
@ -543,7 +523,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..2fd408bd7c6c73ee0106fef75a80f2a9
if (unloadBlocked) { if (unloadBlocked) {
return; return;
} }
@@ -5248,6 +5408,7 @@ @@ -5248,6 +5388,7 @@
} }
let excludeTabs = new Set(aExcludeTabs); let excludeTabs = new Set(aExcludeTabs);
@ -551,7 +531,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..2fd408bd7c6c73ee0106fef75a80f2a9
// If this tab has a successor, it should be selectable, since // If this tab has a successor, it should be selectable, since
// hiding or closing a tab removes that tab as a successor. // hiding or closing a tab removes that tab as a successor.
@@ -5260,13 +5421,13 @@ @@ -5260,13 +5401,13 @@
!excludeTabs.has(aTab.owner) && !excludeTabs.has(aTab.owner) &&
Services.prefs.getBoolPref("browser.tabs.selectOwnerOnClose") Services.prefs.getBoolPref("browser.tabs.selectOwnerOnClose")
) { ) {
@ -567,7 +547,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..2fd408bd7c6c73ee0106fef75a80f2a9
); );
let tab = this.tabContainer.findNextTab(aTab, { let tab = this.tabContainer.findNextTab(aTab, {
@@ -5282,7 +5443,7 @@ @@ -5282,7 +5423,7 @@
} }
if (tab) { if (tab) {
@ -576,7 +556,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..2fd408bd7c6c73ee0106fef75a80f2a9
} }
// If no qualifying visible tab was found, see if there is a tab in // If no qualifying visible tab was found, see if there is a tab in
@@ -5303,7 +5464,7 @@ @@ -5303,7 +5444,7 @@
}); });
} }
@ -585,7 +565,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..2fd408bd7c6c73ee0106fef75a80f2a9
} }
_blurTab(aTab) { _blurTab(aTab) {
@@ -5704,10 +5865,10 @@ @@ -5704,10 +5845,10 @@
SessionStore.deleteCustomTabValue(aTab, "hiddenBy"); SessionStore.deleteCustomTabValue(aTab, "hiddenBy");
} }
@ -598,7 +578,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..2fd408bd7c6c73ee0106fef75a80f2a9
aTab.selected || aTab.selected ||
aTab.closing || aTab.closing ||
// Tabs that are sharing the screen, microphone or camera cannot be hidden. // Tabs that are sharing the screen, microphone or camera cannot be hidden.
@@ -6001,7 +6162,7 @@ @@ -6001,7 +6142,7 @@
// Don't allow mixing pinned and unpinned tabs. // Don't allow mixing pinned and unpinned tabs.
if (this.isTab(element) && element.pinned) { if (this.isTab(element) && element.pinned) {
@ -607,7 +587,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..2fd408bd7c6c73ee0106fef75a80f2a9
} else { } else {
tabIndex = Math.max(tabIndex, this.pinnedTabCount); tabIndex = Math.max(tabIndex, this.pinnedTabCount);
} }
@@ -6028,9 +6189,16 @@ @@ -6028,9 +6169,16 @@
element, element,
() => { () => {
let neighbor = this.tabs[tabIndex]; let neighbor = this.tabs[tabIndex];
@ -625,7 +605,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..2fd408bd7c6c73ee0106fef75a80f2a9
if (neighbor && this.isTab(element) && tabIndex > element._tPos) { if (neighbor && this.isTab(element) && tabIndex > element._tPos) {
neighbor.after(element); neighbor.after(element);
} else { } else {
@@ -6099,7 +6267,9 @@ @@ -6099,7 +6247,9 @@
targetElement = targetElement.group; targetElement = targetElement.group;
} }
} }
@ -636,7 +616,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..2fd408bd7c6c73ee0106fef75a80f2a9
// Don't allow mixing pinned and unpinned tabs. // Don't allow mixing pinned and unpinned tabs.
if (element.pinned && !targetElement?.pinned) { if (element.pinned && !targetElement?.pinned) {
targetElement = this.tabs[this.pinnedTabCount - 1]; targetElement = this.tabs[this.pinnedTabCount - 1];
@@ -6109,7 +6279,13 @@ @@ -6109,7 +6259,13 @@
moveBefore = true; moveBefore = true;
} }
@ -650,7 +630,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..2fd408bd7c6c73ee0106fef75a80f2a9
if (element.pinned && this.tabContainer.verticalMode) { if (element.pinned && this.tabContainer.verticalMode) {
return this.tabContainer.verticalPinnedTabsContainer; return this.tabContainer.verticalPinnedTabsContainer;
} }
@@ -6169,7 +6345,7 @@ @@ -6169,7 +6325,7 @@
if (!this.isTab(aTab)) { if (!this.isTab(aTab)) {
throw new Error("Can only move a tab into a tab group"); throw new Error("Can only move a tab into a tab group");
} }
@ -659,7 +639,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..2fd408bd7c6c73ee0106fef75a80f2a9
return; return;
} }
if (aTab.group && aTab.group.id === aGroup.id) { if (aTab.group && aTab.group.id === aGroup.id) {
@@ -6263,6 +6439,10 @@ @@ -6263,6 +6419,10 @@
moveActionCallback(); moveActionCallback();
@ -670,7 +650,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..2fd408bd7c6c73ee0106fef75a80f2a9
// Clear tabs cache after moving nodes because the order of tabs may have // Clear tabs cache after moving nodes because the order of tabs may have
// changed. // changed.
this.tabContainer._invalidateCachedTabs(); this.tabContainer._invalidateCachedTabs();
@@ -7080,7 +7260,7 @@ @@ -7080,7 +7240,7 @@
// preventDefault(). It will still raise the window if appropriate. // preventDefault(). It will still raise the window if appropriate.
break; break;
} }
@ -679,7 +659,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..2fd408bd7c6c73ee0106fef75a80f2a9
window.focus(); window.focus();
aEvent.preventDefault(); aEvent.preventDefault();
break; break;
@@ -7981,6 +8161,7 @@ @@ -7981,6 +8141,7 @@
aWebProgress.isTopLevel aWebProgress.isTopLevel
) { ) {
this.mTab.setAttribute("busy", "true"); this.mTab.setAttribute("busy", "true");
@ -687,7 +667,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..2fd408bd7c6c73ee0106fef75a80f2a9
gBrowser._tabAttrModified(this.mTab, ["busy"]); gBrowser._tabAttrModified(this.mTab, ["busy"]);
this.mTab._notselectedsinceload = !this.mTab.selected; this.mTab._notselectedsinceload = !this.mTab.selected;
} }
@@ -8954,7 +9135,7 @@ var TabContextMenu = { @@ -8954,7 +9115,7 @@ var TabContextMenu = {
); );
contextUnpinSelectedTabs.hidden = contextUnpinSelectedTabs.hidden =
!this.contextTab.pinned || !this.multiselected; !this.contextTab.pinned || !this.multiselected;
@ -696,7 +676,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..2fd408bd7c6c73ee0106fef75a80f2a9
// Move Tab items // Move Tab items
let contextMoveTabOptions = document.getElementById( let contextMoveTabOptions = document.getElementById(
"context_moveTabOptions" "context_moveTabOptions"
@@ -9223,6 +9404,7 @@ var TabContextMenu = { @@ -9223,6 +9384,7 @@ var TabContextMenu = {
telemetrySource: gBrowser.TabMetrics.METRIC_SOURCE.TAB_STRIP, telemetrySource: gBrowser.TabMetrics.METRIC_SOURCE.TAB_STRIP,
}); });
} else { } else {

View file

@ -1506,6 +1506,8 @@ class ZenViewSplitter extends ZenDOMOperatedFeature {
if (groupIndex >= 0) { if (groupIndex >= 0) {
this.removeTabFromGroup(tab, groupIndex, true); this.removeTabFromGroup(tab, groupIndex, true);
} }
gBrowser.selectedTab = tab;
tab._selected = true;
} }
} }
}; };

View file

@ -1281,7 +1281,7 @@
display: grid; display: grid;
&[hidden='true'] { &[hidden='true'] {
--hidden-essentials-width: calc(var(--actual-zen-sidebar-width) - var(--zen-toolbox-padding) * 2); --hidden-essentials-width: var(--actual-zen-sidebar-width);
max-width: var(--hidden-essentials-width) !important; /* To still allow essentials to grid the tabs */ max-width: var(--hidden-essentials-width) !important; /* To still allow essentials to grid the tabs */
min-width: var(--hidden-essentials-width) !important; min-width: var(--hidden-essentials-width) !important;
} }

View file

@ -793,27 +793,26 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
if (gZenUIManager.testingEnabled) { if (gZenUIManager.testingEnabled) {
return; return;
} }
let showed = false;
if (this._initialTab) { if (this._initialTab) {
this.moveTabToWorkspace(this._initialTab, this.activeWorkspace); this.moveTabToWorkspace(this._initialTab, this.activeWorkspace);
gBrowser.selectedTab = this._initialTab; gBrowser.selectedTab = this._initialTab;
gBrowser.moveTabTo(this._initialTab, { forceUngrouped: true, tabIndex: 0 }); gBrowser.moveTabTo(this._initialTab, { forceUngrouped: true, tabIndex: 0 });
this._initialTab._possiblyEmpty = false; this._initialTab._possiblyEmpty = false;
this._initialTab = null; delete this._initialTab;
} } else if (this._tabToRemoveForEmpty) {
let showed = false;
if (this._tabToRemoveForEmpty) {
if (gZenVerticalTabsManager._canReplaceNewTab) { if (gZenVerticalTabsManager._canReplaceNewTab) {
if (this._tabToSelect) { if (this._tabToSelect) {
gBrowser.selectedTab = this._tabToSelect; gBrowser.selectedTab = this._tabToSelect;
delete this._tabToSelect;
} else { } else {
this.selectEmptyTab(); this.selectEmptyTab();
showed = true; showed = true;
} }
gBrowser.removeTab(this._tabToRemoveForEmpty); gBrowser.removeTab(this._tabToRemoveForEmpty);
} }
delete this._tabToRemoveForEmpty;
} }
delete this._tabToSelect;
delete this._tabToRemoveForEmpty;
if (gZenVerticalTabsManager._canReplaceNewTab && showed) { if (gZenVerticalTabsManager._canReplaceNewTab && showed) {
BrowserCommands.openTab(); BrowserCommands.openTab();
} }
@ -822,7 +821,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
handleInitialTab(tab, isEmpty) { handleInitialTab(tab, isEmpty) {
if (isEmpty) { if (isEmpty) {
tab._possiblyEmpty = true; this._tabToRemoveForEmpty = tab;
} else { } else {
this._initialTab = tab; this._initialTab = tab;
} }
@ -1988,7 +1987,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
newWorkspace, newWorkspace,
shouldAnimate, shouldAnimate,
tabToSelect = null, tabToSelect = null,
{ previousWorkspaceIndex = null, previousWorkspace = null } = {} { previousWorkspaceIndex = null, previousWorkspace = null, onInit = false } = {}
) { ) {
gZenUIManager.tabsWrapper.style.scrollbarWidth = 'none'; gZenUIManager.tabsWrapper.style.scrollbarWidth = 'none';
const kGlobalAnimationDuration = 0.3; const kGlobalAnimationDuration = 0.3;
@ -2059,7 +2058,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
} }
if (offset === 0) { if (offset === 0) {
element.setAttribute('active', 'true'); element.setAttribute('active', 'true');
if (tabToSelect != gBrowser.selectedTab) { if (tabToSelect != gBrowser.selectedTab && !onInit) {
gBrowser.selectedTab = tabToSelect; gBrowser.selectedTab = tabToSelect;
} }
} else { } else {
@ -2291,7 +2290,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
const newTab = this.selectEmptyTab(); const newTab = this.selectEmptyTab();
tabToSelect = newTab; tabToSelect = newTab;
} }
if (tabToSelect) { if (tabToSelect && !onInit) {
tabToSelect._visuallySelected = true; tabToSelect._visuallySelected = true;
} }
@ -2320,6 +2319,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
await this._animateTabs(workspace, !onInit && !this._animatingChange, tabToSelect, { await this._animateTabs(workspace, !onInit && !this._animatingChange, tabToSelect, {
previousWorkspaceIndex, previousWorkspaceIndex,
previousWorkspace, previousWorkspace,
onInit,
}); });
await this._organizeWorkspaceStripLocations(workspace, true); await this._organizeWorkspaceStripLocations(workspace, true);
gZenUIManager.tabsWrapper.style.scrollbarWidth = ''; gZenUIManager.tabsWrapper.style.scrollbarWidth = '';