fix: Fixed foreground tabs showing the toast, b=(closes #8146), c=compact-mode

This commit is contained in:
mr. m 2025-05-08 12:29:35 +02:00
parent 039b7ca85c
commit 2f03446c37
No known key found for this signature in database
GPG key ID: 419302196C23B258
3 changed files with 50 additions and 45 deletions

View file

@ -1,5 +1,5 @@
diff --git a/browser/components/tabbrowser/content/tabbrowser.js b/browser/components/tabbrowser/content/tabbrowser.js
index 6dece2b9d0462d90a28e75350ce983d87816ef73..f191c26b73be69880eb16a83006a9e2a5d0924e5 100644
index 6dece2b9d0462d90a28e75350ce983d87816ef73..4042f332a9d991c31a1725a0f2b4fffebc0d11d8 100644
--- a/browser/components/tabbrowser/content/tabbrowser.js
+++ b/browser/components/tabbrowser/content/tabbrowser.js
@@ -415,11 +415,45 @@
@ -232,17 +232,20 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..f191c26b73be69880eb16a83006a9e2a
}));
if (focusUrlBar) {
@@ -2898,6 +2966,9 @@
@@ -2898,6 +2966,12 @@
}
}
+ if (typeof window.gZenVerticalTabsManager !== "undefined") {
+ gZenVerticalTabsManager.animateTab(t);
+ }
+ if (typeof window.gZenCompactModeManager !== "undefined" && !skipLoad && insertTab) {
+ gZenCompactModeManager._onTabOpen(t, inBackground);
+ }
// Additionally send pinned tab events
if (pinned) {
this._notifyPinnedStatus(t);
@@ -2945,12 +3016,15 @@
@@ -2945,12 +3019,15 @@
* @param {string} [label=]
* @returns {MozTabbrowserTabGroup}
*/
@ -259,7 +262,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..f191c26b73be69880eb16a83006a9e2a
return group;
}
@@ -2993,6 +3067,7 @@
@@ -2993,6 +3070,7 @@
insertBefore = null,
isUserTriggered = false,
telemetryUserCreateSource = "unknown",
@ -267,7 +270,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..f191c26b73be69880eb16a83006a9e2a
} = {}
) {
if (!tabs?.length) {
@@ -3011,7 +3086,12 @@
@@ -3011,7 +3089,12 @@
id = `${Date.now()}-${Math.round(Math.random() * 100)}`;
}
let group = this._createTabGroup(id, color, false, label);
@ -281,7 +284,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..f191c26b73be69880eb16a83006a9e2a
group,
insertBefore?.group ?? insertBefore
);
@@ -3342,6 +3422,7 @@
@@ -3342,6 +3425,7 @@
openWindowInfo,
skipLoad,
triggeringRemoteType,
@ -289,7 +292,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..f191c26b73be69880eb16a83006a9e2a
}
) {
// If we don't have a preferred remote type (or it is `NOT_REMOTE`), and
@@ -3411,6 +3492,7 @@
@@ -3411,6 +3495,7 @@
openWindowInfo,
name,
skipLoad,
@ -297,7 +300,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..f191c26b73be69880eb16a83006a9e2a
});
}
@@ -3599,7 +3681,7 @@
@@ -3599,7 +3684,7 @@
// Add a new tab if needed.
if (!tab) {
let createLazyBrowser =
@ -306,7 +309,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..f191c26b73be69880eb16a83006a9e2a
let url = "about:blank";
if (tabData.entries?.length) {
@@ -3638,6 +3720,27 @@
@@ -3638,6 +3723,27 @@
preferredRemoteType,
});
@ -334,7 +337,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..f191c26b73be69880eb16a83006a9e2a
if (select) {
tabToSelect = tab;
}
@@ -3661,7 +3764,8 @@
@@ -3661,7 +3767,8 @@
// needs calling:
shouldUpdateForPinnedTabs = true;
}
@ -344,7 +347,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..f191c26b73be69880eb16a83006a9e2a
let { groupId } = tabData;
const tabGroup = tabGroupWorkingData.get(groupId);
// if a tab refers to a tab group we don't know, skip any group
@@ -3675,7 +3779,10 @@
@@ -3675,7 +3782,10 @@
tabGroup.stateData.id,
tabGroup.stateData.color,
tabGroup.stateData.collapsed,
@ -356,7 +359,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..f191c26b73be69880eb16a83006a9e2a
);
tabsFragment.appendChild(tabGroup.node);
}
@@ -3723,8 +3830,21 @@
@@ -3723,8 +3833,21 @@
// to remove the old selected tab.
if (tabToSelect) {
let leftoverTab = this.selectedTab;
@ -378,7 +381,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..f191c26b73be69880eb16a83006a9e2a
}
if (tabs.length > 1 || !tabs[0].selected) {
@@ -3912,7 +4032,7 @@
@@ -3912,7 +4035,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.
@ -387,7 +390,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..f191c26b73be69880eb16a83006a9e2a
if (
!bulkOrderedOpen &&
((openerTab &&
@@ -3935,7 +4055,7 @@
@@ -3935,7 +4058,7 @@
) {
index = Infinity;
} else if (previousTab.visible) {
@ -396,7 +399,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..f191c26b73be69880eb16a83006a9e2a
} else if (previousTab == FirefoxViewHandler.tab) {
index = 0;
}
@@ -3958,18 +4078,18 @@
@@ -3958,18 +4081,18 @@
// Ensure index is within bounds.
if (tab.pinned) {
@ -419,7 +422,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..f191c26b73be69880eb16a83006a9e2a
if (this.isTab(itemAfter) && itemAfter.group == tabGroup) {
// Place at the front of, or between tabs in, the same tab group
this.tabContainer.insertBefore(tab, itemAfter);
@@ -4290,6 +4410,9 @@
@@ -4290,6 +4413,9 @@
return;
}
@ -429,7 +432,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..f191c26b73be69880eb16a83006a9e2a
this.removeTabs(selectedTabs, { telemetrySource });
}
@@ -4542,6 +4665,7 @@
@@ -4542,6 +4668,7 @@
telemetrySource,
} = {}
) {
@ -437,7 +440,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..f191c26b73be69880eb16a83006a9e2a
// When 'closeWindowWithLastTab' pref is enabled, closing all tabs
// can be considered equivalent to closing the window.
if (
@@ -4626,6 +4750,7 @@
@@ -4626,6 +4753,7 @@
if (lastToClose) {
this.removeTab(lastToClose, aParams);
}
@ -445,7 +448,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..f191c26b73be69880eb16a83006a9e2a
} catch (e) {
console.error(e);
}
@@ -4650,6 +4775,7 @@
@@ -4650,6 +4778,7 @@
telemetrySource,
} = {}
) {
@ -453,7 +456,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..f191c26b73be69880eb16a83006a9e2a
if (UserInteraction.running("browser.tabs.opening", window)) {
UserInteraction.finish("browser.tabs.opening", window);
}
@@ -4663,6 +4789,12 @@
@@ -4663,6 +4792,12 @@
aTab._closeTimeNoAnimTimerId = Glean.browserTabclose.timeNoAnim.start();
}
@ -466,7 +469,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..f191c26b73be69880eb16a83006a9e2a
// Handle requests for synchronously removing an already
// asynchronously closing tab.
if (!animate && aTab.closing) {
@@ -4677,7 +4809,9 @@
@@ -4677,7 +4812,9 @@
// frame created for it (for example, by updating the visually selected
// state).
let tabWidth = window.windowUtils.getBoundsWithoutFlushing(aTab).width;
@ -477,7 +480,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..f191c26b73be69880eb16a83006a9e2a
if (
!this._beginRemoveTab(aTab, {
closeWindowFastpath: true,
@@ -4840,7 +4974,7 @@
@@ -4840,7 +4977,7 @@
closeWindowWithLastTab != null
? closeWindowWithLastTab
: !window.toolbar.visible ||
@ -486,7 +489,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..f191c26b73be69880eb16a83006a9e2a
if (closeWindow) {
// We've already called beforeunload on all the relevant tabs if we get here,
@@ -4864,6 +4998,7 @@
@@ -4864,6 +5001,7 @@
newTab = true;
}
@ -494,7 +497,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..f191c26b73be69880eb16a83006a9e2a
aTab._endRemoveArgs = [closeWindow, newTab];
// swapBrowsersAndCloseOther will take care of closing the window without animation.
@@ -4903,9 +5038,7 @@
@@ -4903,9 +5041,7 @@
aTab._mouseleave();
if (newTab) {
@ -505,7 +508,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..f191c26b73be69880eb16a83006a9e2a
} else {
TabBarVisibility.update();
}
@@ -5034,6 +5167,8 @@
@@ -5034,6 +5170,8 @@
this.tabs[i]._tPos = i;
}
@ -514,7 +517,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..f191c26b73be69880eb16a83006a9e2a
if (!this._windowIsClosing) {
if (wasPinned) {
this.tabContainer._positionPinnedTabs();
@@ -5159,8 +5294,8 @@
@@ -5159,8 +5297,8 @@
return closedCount;
}
@ -525,7 +528,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..f191c26b73be69880eb16a83006a9e2a
if (unloadBlocked) {
return;
}
@@ -5248,6 +5383,7 @@
@@ -5248,6 +5386,7 @@
}
let excludeTabs = new Set(aExcludeTabs);
@ -533,7 +536,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..f191c26b73be69880eb16a83006a9e2a
// If this tab has a successor, it should be selectable, since
// hiding or closing a tab removes that tab as a successor.
@@ -5260,13 +5396,13 @@
@@ -5260,13 +5399,13 @@
!excludeTabs.has(aTab.owner) &&
Services.prefs.getBoolPref("browser.tabs.selectOwnerOnClose")
) {
@ -549,7 +552,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..f191c26b73be69880eb16a83006a9e2a
);
let tab = this.tabContainer.findNextTab(aTab, {
@@ -5282,7 +5418,7 @@
@@ -5282,7 +5421,7 @@
}
if (tab) {
@ -558,7 +561,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..f191c26b73be69880eb16a83006a9e2a
}
// If no qualifying visible tab was found, see if there is a tab in
@@ -5303,7 +5439,7 @@
@@ -5303,7 +5442,7 @@
});
}
@ -567,7 +570,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..f191c26b73be69880eb16a83006a9e2a
}
_blurTab(aTab) {
@@ -5704,10 +5840,10 @@
@@ -5704,10 +5843,10 @@
SessionStore.deleteCustomTabValue(aTab, "hiddenBy");
}
@ -580,7 +583,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..f191c26b73be69880eb16a83006a9e2a
aTab.selected ||
aTab.closing ||
// Tabs that are sharing the screen, microphone or camera cannot be hidden.
@@ -6001,7 +6137,7 @@
@@ -6001,7 +6140,7 @@
// Don't allow mixing pinned and unpinned tabs.
if (this.isTab(element) && element.pinned) {
@ -589,7 +592,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..f191c26b73be69880eb16a83006a9e2a
} else {
tabIndex = Math.max(tabIndex, this.pinnedTabCount);
}
@@ -6028,9 +6164,16 @@
@@ -6028,9 +6167,16 @@
element,
() => {
let neighbor = this.tabs[tabIndex];
@ -607,7 +610,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..f191c26b73be69880eb16a83006a9e2a
if (neighbor && this.isTab(element) && tabIndex > element._tPos) {
neighbor.after(element);
} else {
@@ -6099,7 +6242,9 @@
@@ -6099,7 +6245,9 @@
targetElement = targetElement.group;
}
}
@ -618,7 +621,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..f191c26b73be69880eb16a83006a9e2a
// Don't allow mixing pinned and unpinned tabs.
if (element.pinned && !targetElement?.pinned) {
targetElement = this.tabs[this.pinnedTabCount - 1];
@@ -6109,7 +6254,13 @@
@@ -6109,7 +6257,13 @@
moveBefore = true;
}
@ -632,7 +635,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..f191c26b73be69880eb16a83006a9e2a
if (element.pinned && this.tabContainer.verticalMode) {
return this.tabContainer.verticalPinnedTabsContainer;
}
@@ -6169,7 +6320,7 @@
@@ -6169,7 +6323,7 @@
if (!this.isTab(aTab)) {
throw new Error("Can only move a tab into a tab group");
}
@ -641,7 +644,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..f191c26b73be69880eb16a83006a9e2a
return;
}
if (aTab.group && aTab.group.id === aGroup.id) {
@@ -6263,6 +6414,10 @@
@@ -6263,6 +6417,10 @@
moveActionCallback();
@ -652,7 +655,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..f191c26b73be69880eb16a83006a9e2a
// Clear tabs cache after moving nodes because the order of tabs may have
// changed.
this.tabContainer._invalidateCachedTabs();
@@ -7080,7 +7235,7 @@
@@ -7080,7 +7238,7 @@
// preventDefault(). It will still raise the window if appropriate.
break;
}
@ -661,7 +664,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..f191c26b73be69880eb16a83006a9e2a
window.focus();
aEvent.preventDefault();
break;
@@ -7981,6 +8136,7 @@
@@ -7981,6 +8139,7 @@
aWebProgress.isTopLevel
) {
this.mTab.setAttribute("busy", "true");
@ -669,7 +672,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..f191c26b73be69880eb16a83006a9e2a
gBrowser._tabAttrModified(this.mTab, ["busy"]);
this.mTab._notselectedsinceload = !this.mTab.selected;
}
@@ -8954,7 +9110,7 @@ var TabContextMenu = {
@@ -8954,7 +9113,7 @@ var TabContextMenu = {
);
contextUnpinSelectedTabs.hidden =
!this.contextTab.pinned || !this.multiselected;
@ -678,7 +681,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..f191c26b73be69880eb16a83006a9e2a
// Move Tab items
let contextMoveTabOptions = document.getElementById(
"context_moveTabOptions"
@@ -9223,6 +9379,7 @@ var TabContextMenu = {
@@ -9223,6 +9382,7 @@ var TabContextMenu = {
telemetrySource: gBrowser.TabMetrics.METRIC_SOURCE.TAB_STRIP,
});
} else {