This commit is contained in:
mr. M
2025-02-15 01:08:40 +01:00
parent 697db429f6
commit 1aea93a57b

View File

@@ -1,8 +1,8 @@
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 ff90a70bdad6c94ec4b90027ff102972d0eb28e5..5db2380df21f4b25a6c03bfa457b62093051cc9a 100644 index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..545a6122bc6d6ee55dab7f020cfbe1f13966d8e2 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
@@ -406,11 +406,39 @@ @@ -406,11 +406,52 @@
return this.tabContainer.visibleTabs; return this.tabContainer.visibleTabs;
} }
@@ -13,6 +13,19 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..5db2380df21f4b25a6c03bfa457b6209
+ break; + break;
+ } + }
+ if (!tab.hidden) { + if (!tab.hidden) {
+ i += !tab.hasAttribute("zen-glance-tab");
+ }
+ }
+ return i;
+ }
+
+ get _numVisiblePinTabsWithoutGlance() {
+ let i = 0;
+ for (let tab of this.tabs) {
+ if (!tab.pinned) {
+ break;
+ }
+ if (!tab.hidden && !tab.hasAttribute("zen-glance-tab")) {
+ i++; + i++;
+ } + }
+ } + }
@@ -26,7 +39,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..5db2380df21f4b25a6c03bfa457b6209
+ break; + break;
+ } + }
+ if (!tab.hidden) { + if (!tab.hidden) {
+ i++; + i += !tab.hasAttribute("zen-glance-tab");
+ } + }
+ } + }
+ return i; + return i;
@@ -40,11 +53,11 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..5db2380df21f4b25a6c03bfa457b6209
+ if (!tab.pinned && !tab.hasAttribute("zen-glance-tab")) { + if (!tab.pinned && !tab.hasAttribute("zen-glance-tab")) {
break; break;
} }
+ i++; + i += !tab.hasAttribute("zen-glance-tab");
} }
return i; return i;
} }
@@ -807,7 +835,7 @@ @@ -807,7 +848,7 @@
this.showTab(aTab); this.showTab(aTab);
if (this.tabContainer.verticalMode) { if (this.tabContainer.verticalMode) {
this._handleTabMove(aTab, () => this._handleTabMove(aTab, () =>
@@ -53,7 +66,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..5db2380df21f4b25a6c03bfa457b6209
); );
} else { } else {
this.moveTabTo(aTab, this.pinnedTabCount, { forceStandaloneTab: true }); this.moveTabTo(aTab, this.pinnedTabCount, { forceStandaloneTab: true });
@@ -828,7 +856,7 @@ @@ -828,7 +869,7 @@
// the moving of a tab from the vertical pinned tabs container // the moving of a tab from the vertical pinned tabs container
// and back into arrowscrollbox. // and back into arrowscrollbox.
aTab.removeAttribute("pinned"); aTab.removeAttribute("pinned");
@@ -62,7 +75,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..5db2380df21f4b25a6c03bfa457b6209
}); });
} else { } else {
this.moveTabTo(aTab, this.pinnedTabCount - 1, { this.moveTabTo(aTab, this.pinnedTabCount - 1, {
@@ -1055,6 +1083,8 @@ @@ -1055,6 +1096,8 @@
let LOCAL_PROTOCOLS = ["chrome:", "about:", "resource:", "data:"]; let LOCAL_PROTOCOLS = ["chrome:", "about:", "resource:", "data:"];
@@ -71,7 +84,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..5db2380df21f4b25a6c03bfa457b6209
if ( if (
aIconURL && aIconURL &&
!aLoadingPrincipal && !aLoadingPrincipal &&
@@ -1065,6 +1095,9 @@ @@ -1065,6 +1108,9 @@
); );
return; return;
} }
@@ -81,7 +94,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..5db2380df21f4b25a6c03bfa457b6209
let browser = this.getBrowserForTab(aTab); let browser = this.getBrowserForTab(aTab);
browser.mIconURL = aIconURL; browser.mIconURL = aIconURL;
@@ -1310,6 +1343,7 @@ @@ -1310,6 +1356,7 @@
if (!this._previewMode) { if (!this._previewMode) {
newTab.recordTimeFromUnloadToReload(); newTab.recordTimeFromUnloadToReload();
newTab.updateLastAccessed(); newTab.updateLastAccessed();
@@ -89,7 +102,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..5db2380df21f4b25a6c03bfa457b6209
oldTab.updateLastAccessed(); oldTab.updateLastAccessed();
// if this is the foreground window, update the last-seen timestamps. // if this is the foreground window, update the last-seen timestamps.
if (this.ownerGlobal == BrowserWindowTracker.getTopWindow()) { if (this.ownerGlobal == BrowserWindowTracker.getTopWindow()) {
@@ -1462,6 +1496,9 @@ @@ -1462,6 +1509,9 @@
} }
let activeEl = document.activeElement; let activeEl = document.activeElement;
@@ -99,7 +112,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..5db2380df21f4b25a6c03bfa457b6209
// If focus is on the old tab, move it to the new tab. // If focus is on the old tab, move it to the new tab.
if (activeEl == oldTab) { if (activeEl == oldTab) {
newTab.focus(); newTab.focus();
@@ -2387,7 +2424,7 @@ @@ -2387,7 +2437,7 @@
let panel = this.getPanel(browser); let panel = this.getPanel(browser);
let uniqueId = this._generateUniquePanelID(); let uniqueId = this._generateUniquePanelID();
@@ -108,7 +121,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..5db2380df21f4b25a6c03bfa457b6209
aTab.linkedPanel = uniqueId; aTab.linkedPanel = uniqueId;
// Inject the <browser> into the DOM if necessary. // Inject the <browser> into the DOM if necessary.
@@ -2446,8 +2483,8 @@ @@ -2446,8 +2496,8 @@
// If we transitioned from one browser to two browsers, we need to set // If we transitioned from one browser to two browsers, we need to set
// hasSiblings=false on both the existing browser and the new browser. // hasSiblings=false on both the existing browser and the new browser.
if (this.tabs.length == 2) { if (this.tabs.length == 2) {
@@ -119,7 +132,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..5db2380df21f4b25a6c03bfa457b6209
} else { } else {
aTab.linkedBrowser.browsingContext.hasSiblings = this.tabs.length > 1; aTab.linkedBrowser.browsingContext.hasSiblings = this.tabs.length > 1;
} }
@@ -2679,6 +2716,12 @@ @@ -2679,6 +2729,12 @@
); );
} }
@@ -132,7 +145,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..5db2380df21f4b25a6c03bfa457b6209
if (!UserInteraction.running("browser.tabs.opening", window)) { if (!UserInteraction.running("browser.tabs.opening", window)) {
UserInteraction.start("browser.tabs.opening", "initting", window); UserInteraction.start("browser.tabs.opening", "initting", window);
} }
@@ -2742,6 +2785,12 @@ @@ -2742,6 +2798,12 @@
noInitialLabel, noInitialLabel,
skipBackgroundNotify, skipBackgroundNotify,
}); });
@@ -145,7 +158,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..5db2380df21f4b25a6c03bfa457b6209
if (insertTab) { if (insertTab) {
// insert the tab into the tab container in the correct position // insert the tab into the tab container in the correct position
this._insertTabAtIndex(t, { this._insertTabAtIndex(t, {
@@ -2885,6 +2934,9 @@ @@ -2885,6 +2947,9 @@
} }
} }
@@ -155,7 +168,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..5db2380df21f4b25a6c03bfa457b6209
// Additionally send pinned tab events // Additionally send pinned tab events
if (pinned) { if (pinned) {
this._notifyPinnedStatus(t); this._notifyPinnedStatus(t);
@@ -3403,6 +3455,21 @@ @@ -3403,6 +3468,21 @@
) { ) {
tabWasReused = true; tabWasReused = true;
tab = this.selectedTab; tab = this.selectedTab;
@@ -177,7 +190,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..5db2380df21f4b25a6c03bfa457b6209
if (!tabData.pinned) { if (!tabData.pinned) {
this.unpinTab(tab); this.unpinTab(tab);
} else { } else {
@@ -3416,6 +3483,7 @@ @@ -3416,6 +3496,7 @@
restoreTabsLazily && !select && !tabData.pinned; restoreTabsLazily && !select && !tabData.pinned;
let url = "about:blank"; let url = "about:blank";
@@ -185,7 +198,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..5db2380df21f4b25a6c03bfa457b6209
if (tabData.entries?.length) { if (tabData.entries?.length) {
let activeIndex = (tabData.index || tabData.entries.length) - 1; let activeIndex = (tabData.index || tabData.entries.length) - 1;
// Ensure the index is in bounds. // Ensure the index is in bounds.
@@ -3451,7 +3519,21 @@ @@ -3451,7 +3532,21 @@
skipLoad: true, skipLoad: true,
preferredRemoteType, preferredRemoteType,
}); });
@@ -208,7 +221,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..5db2380df21f4b25a6c03bfa457b6209
if (select) { if (select) {
tabToSelect = tab; tabToSelect = tab;
} }
@@ -3464,8 +3546,8 @@ @@ -3464,8 +3559,8 @@
// inserted in the DOM. If the tab is not yet in the DOM, // inserted in the DOM. If the tab is not yet in the DOM,
// just insert it in the right place from the start. // just insert it in the right place from the start.
if (!tab.parentNode) { if (!tab.parentNode) {
@@ -219,7 +232,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..5db2380df21f4b25a6c03bfa457b6209
tab.toggleAttribute("pinned", true); tab.toggleAttribute("pinned", true);
this.tabContainer._invalidateCachedTabs(); this.tabContainer._invalidateCachedTabs();
// Then ensure all the tab open/pinning information is sent. // Then ensure all the tab open/pinning information is sent.
@@ -3729,7 +3811,7 @@ @@ -3729,7 +3824,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.
@@ -228,7 +241,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..5db2380df21f4b25a6c03bfa457b6209
if ( if (
!bulkOrderedOpen && !bulkOrderedOpen &&
((openerTab && ((openerTab &&
@@ -3780,7 +3862,7 @@ @@ -3780,7 +3875,7 @@
} }
/** @type {MozTabbrowserTab|undefined} */ /** @type {MozTabbrowserTab|undefined} */
@@ -237,7 +250,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..5db2380df21f4b25a6c03bfa457b6209
this.tabContainer._invalidateCachedTabs(); this.tabContainer._invalidateCachedTabs();
if (tabGroup) { if (tabGroup) {
@@ -4095,6 +4177,9 @@ @@ -4095,6 +4190,9 @@
return; return;
} }
@@ -247,7 +260,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..5db2380df21f4b25a6c03bfa457b6209
this.removeTabs(selectedTabs); this.removeTabs(selectedTabs);
} }
@@ -4427,6 +4512,7 @@ @@ -4427,6 +4525,7 @@
skipSessionStore, skipSessionStore,
} = {} } = {}
) { ) {
@@ -255,7 +268,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..5db2380df21f4b25a6c03bfa457b6209
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);
} }
@@ -4443,6 +4529,12 @@ @@ -4443,6 +4542,12 @@
TelemetryStopwatch.start("FX_TAB_CLOSE_TIME_NO_ANIM_MS", aTab); TelemetryStopwatch.start("FX_TAB_CLOSE_TIME_NO_ANIM_MS", aTab);
} }
@@ -268,7 +281,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..5db2380df21f4b25a6c03bfa457b6209
// 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) {
@@ -4457,7 +4549,9 @@ @@ -4457,7 +4562,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;
@@ -279,7 +292,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..5db2380df21f4b25a6c03bfa457b6209
if ( if (
!this._beginRemoveTab(aTab, { !this._beginRemoveTab(aTab, {
closeWindowFastpath: true, closeWindowFastpath: true,
@@ -4471,7 +4565,6 @@ @@ -4471,7 +4578,6 @@
TelemetryStopwatch.cancel("FX_TAB_CLOSE_TIME_NO_ANIM_MS", aTab); TelemetryStopwatch.cancel("FX_TAB_CLOSE_TIME_NO_ANIM_MS", aTab);
return; return;
} }
@@ -287,7 +300,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..5db2380df21f4b25a6c03bfa457b6209
let lockTabSizing = let lockTabSizing =
!this.tabContainer.verticalMode && !this.tabContainer.verticalMode &&
!aTab.pinned && !aTab.pinned &&
@@ -4610,14 +4703,14 @@ @@ -4610,14 +4716,14 @@
!!this.tabsInCollapsedTabGroups.length; !!this.tabsInCollapsedTabGroups.length;
if ( if (
aTab.visible && aTab.visible &&
@@ -304,7 +317,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..5db2380df21f4b25a6c03bfa457b6209
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,
@@ -4812,6 +4905,8 @@ @@ -4812,6 +4918,8 @@
this.tabs[i]._tPos = i; this.tabs[i]._tPos = i;
} }
@@ -313,7 +326,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..5db2380df21f4b25a6c03bfa457b6209
if (!this._windowIsClosing) { if (!this._windowIsClosing) {
if (wasPinned) { if (wasPinned) {
this.tabContainer._positionPinnedTabs(); this.tabContainer._positionPinnedTabs();
@@ -5465,10 +5560,10 @@ @@ -5465,10 +5573,10 @@
SessionStore.deleteCustomTabValue(aTab, "hiddenBy"); SessionStore.deleteCustomTabValue(aTab, "hiddenBy");
} }
@@ -326,19 +339,19 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..5db2380df21f4b25a6c03bfa457b6209
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.
@@ -5706,9 +5801,9 @@ @@ -5706,9 +5814,9 @@
// Don't allow mixing pinned and unpinned tabs. // Don't allow mixing pinned and unpinned tabs.
if (aTab.pinned) { if (aTab.pinned) {
- aIndex = Math.min(aIndex, this.pinnedTabCount - 1); - aIndex = Math.min(aIndex, this.pinnedTabCount - 1);
+ aIndex = Math.min(aIndex, this._numVisiblePinTabs - 1); + aIndex = Math.min(aIndex, (aTab.hasAttribute('zen-essential') ? this._numZenEssentials : this._numVisiblePinTabsWithoutGlance) - 1);
} else { } else {
- aIndex = Math.max(aIndex, this.pinnedTabCount); - aIndex = Math.max(aIndex, this.pinnedTabCount);
+ aIndex = Math.max(aIndex, this._numVisiblePinTabs); + aIndex = Math.max(aIndex, this._numVisiblePinTabsWithoutGlance);
} }
if (aTab._tPos == aIndex) { if (aTab._tPos == aIndex) {
return; return;
@@ -5727,6 +5822,9 @@ @@ -5727,6 +5835,9 @@
this.tabContainer.insertBefore(aTab, neighbor); this.tabContainer.insertBefore(aTab, neighbor);
} }
}); });
@@ -348,7 +361,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..5db2380df21f4b25a6c03bfa457b6209
} }
moveTabToGroup(aTab, aGroup) { moveTabToGroup(aTab, aGroup) {
@@ -5802,7 +5900,7 @@ @@ -5802,7 +5913,7 @@
createLazyBrowser, createLazyBrowser,
}; };
@@ -357,7 +370,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..5db2380df21f4b25a6c03bfa457b6209
if (aIndex < numPinned || (aTab.pinned && aIndex == numPinned)) { if (aIndex < numPinned || (aTab.pinned && aIndex == numPinned)) {
params.pinned = true; params.pinned = true;
} }
@@ -7443,6 +7541,7 @@ @@ -7443,6 +7554,7 @@
aWebProgress.isTopLevel aWebProgress.isTopLevel
) { ) {
this.mTab.setAttribute("busy", "true"); this.mTab.setAttribute("busy", "true");
@@ -365,7 +378,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..5db2380df21f4b25a6c03bfa457b6209
gBrowser._tabAttrModified(this.mTab, ["busy"]); gBrowser._tabAttrModified(this.mTab, ["busy"]);
this.mTab._notselectedsinceload = !this.mTab.selected; this.mTab._notselectedsinceload = !this.mTab.selected;
gBrowser.syncThrobberAnimations(this.mTab); gBrowser.syncThrobberAnimations(this.mTab);
@@ -8411,7 +8510,7 @@ var TabContextMenu = { @@ -8411,7 +8523,7 @@ var TabContextMenu = {
); );
contextUnpinSelectedTabs.hidden = contextUnpinSelectedTabs.hidden =
!this.contextTab.pinned || !multiselectionContext; !this.contextTab.pinned || !multiselectionContext;
@@ -374,7 +387,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..5db2380df21f4b25a6c03bfa457b6209
// Move Tab items // Move Tab items
let contextMoveTabOptions = document.getElementById( let contextMoveTabOptions = document.getElementById(
"context_moveTabOptions" "context_moveTabOptions"
@@ -8444,7 +8543,7 @@ var TabContextMenu = { @@ -8444,7 +8556,7 @@ var TabContextMenu = {
let contextMoveTabToStart = document.getElementById("context_moveToStart"); let contextMoveTabToStart = document.getElementById("context_moveToStart");
let isFirstTab = let isFirstTab =
tabsToMove[0] == visibleTabs[0] || tabsToMove[0] == visibleTabs[0] ||
@@ -383,7 +396,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..5db2380df21f4b25a6c03bfa457b6209
contextMoveTabToStart.disabled = isFirstTab && allSelectedTabsAdjacent; contextMoveTabToStart.disabled = isFirstTab && allSelectedTabsAdjacent;
document.getElementById("context_openTabInWindow").disabled = document.getElementById("context_openTabInWindow").disabled =
@@ -8677,6 +8776,7 @@ var TabContextMenu = { @@ -8677,6 +8789,7 @@ var TabContextMenu = {
if (this.contextTab.multiselected) { if (this.contextTab.multiselected) {
gBrowser.removeMultiSelectedTabs(); gBrowser.removeMultiSelectedTabs();
} else { } else {