diff --git a/browser/components/tabbrowser/content/tabbrowser.js b/browser/components/tabbrowser/content/tabbrowser.js index ef857bd81f2cd7c163ecc74ac1cf81a0b63ce838..807eb0c493f15643412b05d8dad81d36d7470155 100644 --- a/browser/components/tabbrowser/content/tabbrowser.js +++ b/browser/components/tabbrowser/content/tabbrowser.js @@ -452,11 +452,26 @@ return duplicateTabs; }, + get _numVisiblePinTabs() { + let i = 0; + for (let tab of this.tabs) { + if (!tab.pinned) { + break; + } + if (!tab.hidden) { + i++; + } + } + return i; + }, + get _numPinnedTabs() { - for (var i = 0; i < this.tabs.length; i++) { - if (!this.tabs[i].pinned) { + let i = 0; + for (let tab of this.tabs) { + if (!tab.pinned) { break; } + i++; } return i; }, @@ -2704,6 +2719,11 @@ ); } + let hasZenDefaultUserContextId = false; + if (typeof ZenWorkspaces !== "undefined") { + [userContextId, hasZenDefaultUserContextId] = ZenWorkspaces.getContextIdIfNeeded(userContextId); + } + if (!UserInteraction.running("browser.tabs.opening", window)) { UserInteraction.start("browser.tabs.opening", "initting", window); } @@ -2771,6 +2791,9 @@ noInitialLabel, skipBackgroundNotify, }); + if (hasZenDefaultUserContextId) { + t.setAttribute("zenDefaultUserContextId", "true"); + } if (insertTab) { // insert the tab into the tab container in the correct position this._insertTabAtIndex(t, { @@ -3248,6 +3271,14 @@ ) { tabWasReused = true; tab = this.selectedTab; + + if (tabData.zenWorkspace) { + tab.setAttribute("zen-workspace-id", tabData.zenWorkspace); + } + if (tabData.zenDefaultUserContextId) { + tab.setAttribute("zenDefaultUserContextId", "true"); + } + if (!tabData.pinned) { this.unpinTab(tab); } else { @@ -3297,6 +3328,13 @@ preferredRemoteType, }); + if (tabData.zenWorkspace) { + tab.setAttribute("zen-workspace-id", tabData.zenWorkspace); + } + if (tabData.zenDefaultUserContextId) { + tab.setAttribute("zenDefaultUserContextId", "true"); + } + if (select) { tabToSelect = tab; } @@ -4184,6 +4222,7 @@ isLastTab || aTab.pinned || aTab.hidden || + true || this._removingTabs.size > 3 /* don't want lots of concurrent animations */ || !aTab.hasAttribute( @@ -5117,10 +5156,10 @@ SessionStore.deleteCustomTabValue(aTab, "hiddenBy"); }, - hideTab(aTab, aSource) { + hideTab(aTab, aSource, forZenWorkspaces = false) { if ( aTab.hidden || - aTab.pinned || + (aTab.pinned && !forZenWorkspaces) || aTab.selected || aTab.closing || // Tabs that are sharing the screen, microphone or camera cannot be hidden.