diff --git a/browser/components/tabbrowser/content/tabbrowser.js b/browser/components/tabbrowser/content/tabbrowser.js index 5f406ea5d09273c9b70b84eee24c6267f88692f8..d7bf3cb603b61f2a699e5265ee47026aeb4ca222 100644 --- a/browser/components/tabbrowser/content/tabbrowser.js +++ b/browser/components/tabbrowser/content/tabbrowser.js @@ -424,11 +424,67 @@ return this.tabContainer.visibleTabs; } + get _numVisiblePinTabs() { + let i = 0; + for (let tab of this.tabs) { + if (!tab.pinned && !tab.hasAttribute("zen-glance-tab")) { + break; + } + if (!tab.hidden) { + i += !tab.hasAttribute("zen-glance-tab"); + } + } + return i; + } + + get _numVisiblePinTabsWithoutCollapsed() { + let i = 0; + for (let item of this.tabContainer.ariaFocusableItems) { + if (!!item?.classList?.contains("tab-group-label") && item.closest("tab-group").pinned) { + i += 1; + continue; + } + if (!item.pinned && !item.hasAttribute("zen-glance-tab")) { + break; + } + if ((!item.group?.hasAttribute("split-view-group") && !item.group?.collapsed) && !item.hidden) { + i += !item.hasAttribute("zen-glance-tab"); + } + } + return i; + } + + get _numZenEssentials() { + let i = 0; + for (let tab of this.tabs) { + if (!tab.hasAttribute("zen-essential") && !tab.hasAttribute("zen-glance-tab")) { + break; + } + i += !tab.hasAttribute("zen-glance-tab"); + } + return i; + } + + get _numZenVisibleEssentials() { + let i = 0; + for (let tab of this.tabs) { + if (!tab.hasAttribute("zen-essential") && !tab.hasAttribute("zen-glance-tab")) { + break; + } + if (!tab.hidden) { + i += !tab.hasAttribute("zen-glance-tab"); + } + } + return i; + } + get pinnedTabCount() { - 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 && !tab.hasAttribute("zen-glance-tab")) { break; } + i += !tab.hasAttribute("zen-glance-tab"); } return i; } @@ -558,6 +614,7 @@ this.tabpanels.appendChild(panel); let tab = this.tabs[0]; + ZenWorkspaces.handleInitialTab(tab, (!remoteType || remoteType === E10SUtils.PRIVILEGEDABOUT_REMOTE_TYPE) && !Services.prefs.getBoolPref('zen.workspaces.disable_empty_state_for_testing', false)); tab.linkedPanel = uniqueId; this._selectedTab = tab; this._selectedBrowser = browser; @@ -823,11 +880,13 @@ } this.showTab(aTab); - if (this.tabContainer.verticalMode) { + const handled = gZenFolders.handleTabPin(aTab); + if (!handled) this.ungroupTab(aTab); + if (this.tabContainer.verticalMode && !handled) { this.#handleTabMove(aTab, () => - this.verticalPinnedTabsContainer.appendChild(aTab) + aTab.hasAttribute("zen-essential") ? document.getElementById("zen-essentials-container").appendChild(aTab) : this.verticalPinnedTabsContainer.insertBefore(aTab, this.verticalPinnedTabsContainer.lastChild) ); - } else { + } else if (!handled) { this.moveTabTo(aTab, this.pinnedTabCount, { forceStandaloneTab: true }); } aTab.setAttribute("pinned", "true"); @@ -841,12 +900,15 @@ } if (this.tabContainer.verticalMode) { + const handled = gZenFolders.handleTabUnpin(aTab); this.#handleTabMove(aTab, () => { // we remove this attribute first, so that allTabs represents // the moving of a tab from the vertical pinned tabs container // and back into arrowscrollbox. aTab.removeAttribute("pinned"); - this.tabContainer.arrowScrollbox.prepend(aTab); + if (!handled) { + ZenWorkspaces.activeWorkspaceStrip.prepend(aTab); + } }); } else { this.moveTabTo(aTab, this.pinnedTabCount - 1, { @@ -1029,6 +1091,8 @@ let LOCAL_PROTOCOLS = ["chrome:", "about:", "resource:", "data:"]; + try { + gZenPinnedTabManager.onTabIconChanged(aTab, aIconURL); if ( aIconURL && !aLoadingPrincipal && @@ -1039,6 +1103,9 @@ ); return; } + } catch (e) { + console.warn(e); + } let browser = this.getBrowserForTab(aTab); browser.mIconURL = aIconURL; @@ -1287,6 +1354,7 @@ if (!this._previewMode) { newTab.recordTimeFromUnloadToReload(); newTab.updateLastAccessed(); + newTab.removeAttribute("unread"); oldTab.updateLastAccessed(); // if this is the foreground window, update the last-seen timestamps. if (this.ownerGlobal == BrowserWindowTracker.getTopWindow()) { @@ -1439,6 +1507,9 @@ } let activeEl = document.activeElement; + if (gURLBar._zenHandleUrlbarClose) { + gURLBar._zenHandleUrlbarClose(true); + } // If focus is on the old tab, move it to the new tab. if (activeEl == oldTab) { newTab.focus(); @@ -1762,7 +1833,7 @@ } _setTabLabel(aTab, aLabel, { beforeTabOpen, isContentTitle, isURL } = {}) { - if (!aLabel || aLabel.includes("about:reader?")) { + if (!aLabel || aLabel.includes("about:reader?") || aTab.hasAttribute("zen-has-static-label")) { return false; } @@ -1865,7 +1936,7 @@ newIndex = this.selectedTab._tPos + 1; } - if (replace) { + if (replace && !(!targetTab && this.selectedTab?.hasAttribute('zen-empty-tab'))) { let browser; if (targetTab) { browser = this.getBrowserForTab(targetTab); @@ -2122,6 +2193,7 @@ uriIsAboutBlank, userContextId, skipLoad, + _forZenEmptyTab, } = {}) { let b = document.createXULElement("browser"); // Use the JSM global to create the permanentKey, so that if the @@ -2195,8 +2267,7 @@ // we use a different attribute name for this? b.setAttribute("name", name); } - - if (this._allowTransparentBrowser) { + if (this._allowTransparentBrowser || _forZenEmptyTab) { b.setAttribute("transparent", "true"); } @@ -2373,7 +2444,7 @@ let panel = this.getPanel(browser); let uniqueId = this._generateUniquePanelID(); - panel.id = uniqueId; + if (!panel.id?.startsWith("zen-")) panel.id = uniqueId; aTab.linkedPanel = uniqueId; // Inject the into the DOM if necessary. @@ -2432,8 +2503,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) { - this.tabs[0].linkedBrowser.browsingContext.hasSiblings = true; - this.tabs[1].linkedBrowser.browsingContext.hasSiblings = true; + if (this.tabs[0].linkedBrowser.browsingContext) this.tabs[0].linkedBrowser.browsingContext.hasSiblings = true; + if (this.tabs[1].linkedBrowser.browsingContext) this.tabs[1].linkedBrowser.browsingContext.hasSiblings = true; } else { aTab.linkedBrowser.browsingContext.hasSiblings = this.tabs.length > 1; } @@ -2655,6 +2726,7 @@ schemelessInput, hasValidUserGestureActivation = false, textDirectiveUserActivation = false, + _forZenEmptyTab, } = {} ) { // all callers of addTab that pass a params object need to pass @@ -2665,6 +2737,12 @@ ); } + let hasZenDefaultUserContextId = false; + let zenForcedWorkspaceId = undefined; + if (typeof ZenWorkspaces !== "undefined" && !_forZenEmptyTab) { + [userContextId, hasZenDefaultUserContextId, zenForcedWorkspaceId] = ZenWorkspaces.getContextIdIfNeeded(userContextId, fromExternal, allowInheritPrincipal); + } + if (!UserInteraction.running("browser.tabs.opening", window)) { UserInteraction.start("browser.tabs.opening", "initting", window); } @@ -2728,6 +2806,16 @@ noInitialLabel, skipBackgroundNotify, }); + if (hasZenDefaultUserContextId) { + t.setAttribute("zenDefaultUserContextId", "true"); + } + if (zenForcedWorkspaceId !== undefined) { + t.setAttribute("zen-workspace-id", zenForcedWorkspaceId); + t.setAttribute("change-workspace", "") + } + if (_forZenEmptyTab) { + t.setAttribute("zen-empty-tab", "true"); + } if (insertTab) { // insert the tab into the tab container in the correct position this._insertTabAtIndex(t, { @@ -2752,6 +2840,7 @@ initialBrowsingContextGroupId, openWindowInfo, skipLoad, + _forZenEmptyTab, })); if (focusUrlBar) { @@ -2871,6 +2960,9 @@ } } + if (typeof window.gZenVerticalTabsManager !== "undefined") { + gZenVerticalTabsManager.animateTab(t); + } // Additionally send pinned tab events if (pinned) { this._notifyPinnedStatus(t); @@ -2891,12 +2983,15 @@ * @param {string} [label=] * @returns {MozTabbrowserTabGroup} */ - _createTabGroup(id, color, collapsed, label = "") { + _createTabGroup(id, color, collapsed, label = "", pinned = false, essential = false, splitViewGroup = false) { let group = document.createXULElement("tab-group", { is: "tab-group" }); group.id = id; group.collapsed = collapsed; group.color = color; group.label = label; + group.pinned = pinned; + group.essential = essential; + if (splitViewGroup) group.setAttribute('split-view-group', true); return group; } @@ -2937,11 +3032,9 @@ insertBefore = null, isUserCreated = false, telemetryUserCreateSource = "unknown", + forSplitView = false, } = {} ) { - if (!tabs?.length) { - throw new Error("Cannot create tab group with zero tabs"); - } if (!color) { color = this.tabGroupMenu.nextUnusedColor; @@ -2951,7 +3044,12 @@ id = `${Date.now()}-${Math.round(Math.random() * 100)}`; } let group = this._createTabGroup(id, color, false, label); - this.tabContainer.insertBefore( + if (forSplitView) { + group.setAttribute('split-view-group', true); + } + group.essential = tabs.some(tab => tab.hasAttribute("essential")); + group.pinned = group.essential || tabs.some(tab => tab.pinned); + ((insertBefore?.group ?? insertBefore).parentNode).insertBefore( group, insertBefore?.group ?? insertBefore ); @@ -2959,10 +3057,6 @@ // Bail out if the group is empty at this point. This can happen if all // provided tabs are pinned and therefore cannot be grouped. - if (!group.tabs.length) { - group.remove(); - return null; - } if (this._smartTabGroupsEnabled) { gBrowser.getGroupTitleForTabs(tabs).then(newLabel => { @@ -3268,6 +3362,7 @@ initialBrowsingContextGroupId, openWindowInfo, skipLoad, + _forZenEmptyTab } ) { // If we don't have a preferred remote type, and we have a remote @@ -3331,6 +3426,7 @@ openWindowInfo, name, skipLoad, + _forZenEmptyTab }); } @@ -3509,6 +3605,27 @@ ) { tabWasReused = true; tab = this.selectedTab; + if (tabData.zenWorkspace) { + tab.setAttribute("zen-workspace-id", tabData.zenWorkspace); + } + if (tabData.zenIsEmpty) { + tab.setAttribute("zen-empty-tab", "true"); + } + 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 { @@ -3522,6 +3639,7 @@ restoreTabsLazily && !select && !tabData.pinned; let url = "about:blank"; + gZenPinnedTabManager.resetPinnedTabData(tabData); if (tabData.entries?.length) { let activeIndex = (tabData.index || tabData.entries.length) - 1; // Ensure the index is in bounds. @@ -3557,7 +3675,27 @@ skipLoad: true, preferredRemoteType, }); - + if (tabData.zenWorkspace) { + tab.setAttribute("zen-workspace-id", tabData.zenWorkspace); + } + if (tabData.zenPinnedId) { + tab.setAttribute("zen-pin-id", tabData.zenPinnedId); + } + if (tabData.zenIsEmpty) { + tab.setAttribute("zen-empty-tab", "true"); + } + if (tabData.zenHasStaticLabel) { + tab.setAttribute("zen-has-static-label", "true"); + } + 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 (select) { tabToSelect = tab; } @@ -3570,8 +3708,8 @@ // inserted in the DOM. If the tab is not yet in the DOM, // just insert it in the right place from the start. if (!tab.parentNode) { - tab._tPos = this.pinnedTabCount; - this.tabContainer.insertBefore(tab, this.tabs[this.pinnedTabCount]); + tab._tPos = this._numVisiblePinTabs; + this.tabContainer.insertBefore(tab, this.tabs[this._numVisiblePinTabs]); tab.toggleAttribute("pinned", true); this.tabContainer._invalidateCachedTabs(); // Then ensure all the tab open/pinning information is sent. @@ -3581,7 +3719,8 @@ // needs calling: shouldUpdateForPinnedTabs = true; } - } else if (tabData.groupId) { + } + if (tabData.groupId) { let { groupId } = tabData; const tabGroup = tabGroupWorkingData.get(groupId); // if a tab refers to a tab group we don't know, skip any group @@ -3595,7 +3734,10 @@ tabGroup.stateData.id, tabGroup.stateData.color, tabGroup.stateData.collapsed, - tabGroup.stateData.name + tabGroup.stateData.name, + tabGroup.stateData.pinned, + tabGroup.stateData.essential, + tabGroup.stateData.splitView, ); tabsFragment.appendChild(tabGroup.node); } @@ -3646,6 +3788,9 @@ this.selectedTab = tabToSelect; this.removeTab(leftoverTab); } + else { + this.selectedTab._possiblyEmpty = this.selectedTab.isEmpty; // Not needed, but just in case. + } if (tabs.length > 1 || !tabs[0].selected) { this._updateTabsAfterInsert(); @@ -3830,7 +3975,7 @@ // Ensure we have an index if one was not provided. if (typeof index != "number") { // Move the new tab after another tab if needed, to the end otherwise. - index = Infinity; + index = Services.prefs.getBoolPref("zen.view.show-newtab-button-top") ? this.pinnedTabCount : Infinity; if ( !bulkOrderedOpen && ((openerTab && @@ -3876,18 +4021,18 @@ // Ensure index is within bounds. if (tab.pinned) { - index = Math.max(index, 0); - index = Math.min(index, this.pinnedTabCount); + index = Math.max(index, tab.hasAttribute("zen-essential") ? 0 : this._numZenEssentials); + index = Math.min(index, tab.hasAttribute("zen-essential") ? this._numZenEssentials : this.pinnedTabCount); } else { index = Math.max(index, this.pinnedTabCount); index = Math.min(index, this.tabs.length); } /** @type {MozTabbrowserTab|undefined} */ - let tabAfter = this.tabs.at(index); + let tabAfter = this.tabs.filter(tab => !tab.hasAttribute("zen-glance-tab")).at(index); this.tabContainer._invalidateCachedTabs(); - if (tabGroup) { + if (tabGroup && !tabGroup.hasAttribute("split-view-group")) { if (tabAfter && tabAfter.group == tabGroup) { // Place at the front of, or between tabs in, the same tab group this.tabContainer.insertBefore(tab, tabAfter); @@ -4199,6 +4344,9 @@ return; } + for (let tab of selectedTabs) { + gZenPinnedTabManager._removePinnedAttributes(tab, true); + } this.removeTabs(selectedTabs); } @@ -4556,6 +4704,7 @@ skipSessionStore, } = {} ) { + gZenUIManager.saveScrollbarState(); if (UserInteraction.running("browser.tabs.opening", window)) { UserInteraction.finish("browser.tabs.opening", window); } @@ -4572,6 +4721,12 @@ TelemetryStopwatch.start("FX_TAB_CLOSE_TIME_NO_ANIM_MS", aTab); } + if (ZenWorkspaces.workspaceEnabled) { + let newTab = ZenWorkspaces.handleTabBeforeClose(aTab); + if (newTab) { + this.selectedTab = newTab; + } + } // Handle requests for synchronously removing an already // asynchronously closing tab. if (!animate && aTab.closing) { @@ -4586,7 +4741,9 @@ // frame created for it (for example, by updating the visually selected // state). let tabWidth = window.windowUtils.getBoundsWithoutFlushing(aTab).width; - + if (gZenGlanceManager.manageTabClose(aTab)) { + return; + } if ( !this._beginRemoveTab(aTab, { closeWindowFastpath: true, @@ -4600,7 +4757,6 @@ TelemetryStopwatch.cancel("FX_TAB_CLOSE_TIME_NO_ANIM_MS", aTab); return; } - let lockTabSizing = !this.tabContainer.verticalMode && !aTab.pinned && @@ -4739,14 +4895,14 @@ !!this.tabsInCollapsedTabGroups.length; if ( aTab.visible && - this.visibleTabs.length == 1 && + this.visibleTabs.length == 1 && !aTab._closingGlance && !anyRemainingTabsInCollapsedTabGroups ) { closeWindow = closeWindowWithLastTab != null ? closeWindowWithLastTab : !window.toolbar.visible || - Services.prefs.getBoolPref("browser.tabs.closeWindowWithLastTab"); + Services.prefs.getBoolPref("browser.tabs.closeWindowWithLastTab") && !ZenWorkspaces._isClosingWindow && !ZenWorkspaces._removedByStartupPage; if (closeWindow) { // We've already called beforeunload on all the relevant tabs if we get here, @@ -4770,6 +4926,7 @@ newTab = true; } + ZenWorkspaces._removedByStartupPage = false; aTab._endRemoveArgs = [closeWindow, newTab]; // swapBrowsersAndCloseOther will take care of closing the window without animation. @@ -4810,9 +4967,7 @@ aTab._mouseleave(); if (newTab) { - this.addTrustedTab(BROWSER_NEW_TAB_URL, { - skipAnimation: true, - }); + ZenWorkspaces.selectEmptyTab(BROWSER_NEW_TAB_URL); } else { TabBarVisibility.update(); } @@ -4941,6 +5096,8 @@ this.tabs[i]._tPos = i; } + ZenWorkspaces.updateTabsContainers(); + if (!this._windowIsClosing) { if (wasPinned) { this.tabContainer._positionPinnedTabs(); @@ -5064,8 +5221,8 @@ return closedCount; } - async explicitUnloadTabs(tabs) { - let unloadBlocked = await this.runBeforeUnloadForTabs(tabs); + async explicitUnloadTabs(tabs, skipPermitUnload = false) { + let unloadBlocked = skipPermitUnload ? false : await this.runBeforeUnloadForTabs(tabs); if (unloadBlocked) { return; } @@ -5159,7 +5316,7 @@ !excludeTabs.has(aTab.owner) && Services.prefs.getBoolPref("browser.tabs.selectOwnerOnClose") ) { - return aTab.owner; + return ZenWorkspaces.findTabToBlur(aTab.owner); } // Try to find a remaining tab that comes after the given tab @@ -5181,7 +5338,7 @@ } if (tab) { - return tab; + return ZenWorkspaces.findTabToBlur(tab); } // If no qualifying visible tab was found, see if there is a tab in @@ -5599,10 +5756,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. @@ -5838,7 +5995,7 @@ moveTabTo(aTab, aIndex, { forceStandaloneTab = false } = {}) { // Don't allow mixing pinned and unpinned tabs. if (aTab.pinned) { - aIndex = Math.min(aIndex, this.pinnedTabCount - 1); + aIndex = aTab.hasAttribute('zen-essential') ? Math.min(aIndex, this._numZenEssentials - 1) : Math.min(aIndex, this.pinnedTabCount - 1); } else { aIndex = Math.max(aIndex, this.pinnedTabCount); } @@ -5848,10 +6005,17 @@ this.#handleTabMove(aTab, () => { let neighbor = this.tabs[aIndex]; - if (forceStandaloneTab && neighbor.group) { + const _tPos = aTab._tPos; + if ((forceStandaloneTab && neighbor.group) || neighbor.group?.hasAttribute("split-view-group")) { neighbor = neighbor.group; } - if (neighbor && aIndex > aTab._tPos) { + if (aTab.group?.hasAttribute("split-view-group")) { + aTab = aTab.group; + } + if (aTab.group?.hasAttribute("split-view-group") && neighbor == aTab.group) { + return; + } + if (neighbor && aIndex >= _tPos) { neighbor.after(aTab); } else { this.tabContainer.insertBefore(aTab, neighbor); @@ -5901,13 +6065,22 @@ * Bug 1955388 - prevent pinned tabs from commingling with non-pinned tabs * when there are hidden tabs present */ + if (tab.group?.hasAttribute("split-view-group")) { + tab = tab.group; + } + if (tab.pinned && !targetElement?.pinned) { // prevent pinned tab from being dragged past a non-pinned tab targetElement = this.tabs[this.pinnedTabCount - 1]; moveBefore = false; } - + if (targetElement?.group?.hasAttribute("split-view-group")) { + targetElement = targetElement.group; + } let getContainer = () => { + if (tab.hasAttribute("zen-essential")) { + return document.getElementById("zen-essentials-container"); + } if (tab.pinned && this.tabContainer.verticalMode) { return this.tabContainer.verticalPinnedTabsContainer; } @@ -5915,7 +6088,11 @@ }; this.#handleTabMove(tab, () => { if (moveBefore) { + if (targetElement) { + targetElement.before(tab); + } else { getContainer().insertBefore(tab, targetElement); + } } else if (targetElement) { targetElement.after(tab); } else { @@ -5937,7 +6114,7 @@ } moveTabToGroup(aTab, aGroup) { - if (aTab.pinned) { + if (aTab.pinned != !!aGroup.pinned) { return; } if (aTab.group && aTab.group.id === aGroup.id) { @@ -5961,6 +6138,10 @@ moveActionCallback(); + ZenWorkspaces._makeSureEmptyTabIsLast(); + gZenViewSplitter._maybeRemoveFakeBrowser(false); + gZenViewSplitter._canDrop = false; + // Clear tabs cache after moving nodes because the order of tabs may have // changed. this.tabContainer._invalidateCachedTabs(); @@ -6015,7 +6196,7 @@ createLazyBrowser, }; - let numPinned = this.pinnedTabCount; + let numPinned = this._numVisiblePinTabs; if (aIndex < numPinned || (aTab.pinned && aIndex == numPinned)) { params.pinned = true; } @@ -6765,7 +6946,7 @@ // preventDefault(). It will still raise the window if appropriate. break; } - this.selectedTab = tab; + ZenWorkspaces.switchTabIfNeeded(tab); window.focus(); aEvent.preventDefault(); break; @@ -7671,6 +7852,7 @@ aWebProgress.isTopLevel ) { this.mTab.setAttribute("busy", "true"); + if (!this.mTab.selected) this.mTab.setAttribute("unread", "true"); gBrowser._tabAttrModified(this.mTab, ["busy"]); this.mTab._notselectedsinceload = !this.mTab.selected; } @@ -8640,7 +8822,7 @@ var TabContextMenu = { ); contextUnpinSelectedTabs.hidden = !this.contextTab.pinned || !this.multiselected; - + gZenPinnedTabManager.updatePinnedTabContextMenu(this.contextTab); // Move Tab items let contextMoveTabOptions = document.getElementById( "context_moveTabOptions" @@ -8674,7 +8856,7 @@ var TabContextMenu = { let isFirstTab = !this.contextTabs[0].group && (this.contextTabs[0] == visibleTabs[0] || - this.contextTabs[0] == visibleTabs[gBrowser.pinnedTabCount]); + this.contextTabs[0] == visibleTabs[gBrowser._numVisiblePinTabs]); contextMoveTabToStart.disabled = isFirstTab && allSelectedTabsAdjacent; document.getElementById("context_openTabInWindow").disabled = @@ -8904,6 +9086,7 @@ var TabContextMenu = { if (this.contextTab.multiselected) { gBrowser.removeMultiSelectedTabs(); } else { + gZenPinnedTabManager._removePinnedAttributes(this.contextTab, true); gBrowser.removeTab(this.contextTab, { animate: true }); } },