Refactor tab closing logic to improve handling of zen glance tabs and enhance tab sizing behavior

This commit is contained in:
mr. M 2025-01-27 18:45:59 +01:00
parent d4dd298ef8
commit 7deaecc123
No known key found for this signature in database
GPG key ID: CBD57A2AEDBDA1FB

View file

@ -1,5 +1,5 @@
diff --git a/browser/components/tabbrowser/content/tabbrowser.js b/browser/components/tabbrowser/content/tabbrowser.js
index ce68c339f35416574b7bc7ebf8c93378f653242b..ceb292dd9939bd9db12b00673f0c3d54da793e76 100644
index ce68c339f35416574b7bc7ebf8c93378f653242b..e01b690e5df5f828909c204dce8043469f4ff655 100644
--- a/browser/components/tabbrowser/content/tabbrowser.js
+++ b/browser/components/tabbrowser/content/tabbrowser.js
@@ -409,11 +409,39 @@
@ -227,18 +227,19 @@ index ce68c339f35416574b7bc7ebf8c93378f653242b..ceb292dd9939bd9db12b00673f0c3d54
// Handle requests for synchronously removing an already
// asynchronously closing tab.
if (!animate && aTab.closing) {
@@ -4404,6 +4502,10 @@
// state).
let tabWidth = window.windowUtils.getBoundsWithoutFlushing(aTab).width;
@@ -4417,7 +4515,10 @@
TelemetryStopwatch.cancel("FX_TAB_CLOSE_TIME_NO_ANIM_MS", aTab);
return;
}
-
+ if (aTab.hasAttribute("zen-glance-tab")) {
+ gZenGlanceManager.closeGlance();
+ return;
+ }
if (
!this._beginRemoveTab(aTab, {
closeWindowFastpath: true,
@@ -4556,14 +4658,14 @@
let lockTabSizing =
!this.tabContainer.verticalMode &&
!aTab.pinned &&
@@ -4556,14 +4657,14 @@
!!this.tabsInCollapsedTabGroups.length;
if (
aTab.visible &&
@ -255,7 +256,7 @@ index ce68c339f35416574b7bc7ebf8c93378f653242b..ceb292dd9939bd9db12b00673f0c3d54
if (closeWindow) {
// We've already called beforeunload on all the relevant tabs if we get here,
@@ -5411,10 +5513,10 @@
@@ -5411,10 +5512,10 @@
SessionStore.deleteCustomTabValue(aTab, "hiddenBy");
}
@ -268,7 +269,7 @@ index ce68c339f35416574b7bc7ebf8c93378f653242b..ceb292dd9939bd9db12b00673f0c3d54
aTab.selected ||
aTab.closing ||
// Tabs that are sharing the screen, microphone or camera cannot be hidden.
@@ -7384,6 +7486,7 @@
@@ -7384,6 +7485,7 @@
aWebProgress.isTopLevel
) {
this.mTab.setAttribute("busy", "true");
@ -276,7 +277,7 @@ index ce68c339f35416574b7bc7ebf8c93378f653242b..ceb292dd9939bd9db12b00673f0c3d54
gBrowser._tabAttrModified(this.mTab, ["busy"]);
this.mTab._notselectedsinceload = !this.mTab.selected;
gBrowser.syncThrobberAnimations(this.mTab);
@@ -8344,7 +8447,7 @@ var TabContextMenu = {
@@ -8344,7 +8446,7 @@ var TabContextMenu = {
);
contextUnpinSelectedTabs.hidden =
!this.contextTab.pinned || !multiselectionContext;
@ -285,7 +286,7 @@ index ce68c339f35416574b7bc7ebf8c93378f653242b..ceb292dd9939bd9db12b00673f0c3d54
// Move Tab items
let contextMoveTabOptions = document.getElementById(
"context_moveTabOptions"
@@ -8378,7 +8481,7 @@ var TabContextMenu = {
@@ -8378,7 +8480,7 @@ var TabContextMenu = {
let contextMoveTabToStart = document.getElementById("context_moveToStart");
let isFirstTab =
tabsToMove[0] == visibleTabs[0] ||
@ -294,7 +295,7 @@ index ce68c339f35416574b7bc7ebf8c93378f653242b..ceb292dd9939bd9db12b00673f0c3d54
contextMoveTabToStart.disabled = isFirstTab && allSelectedTabsAdjacent;
document.getElementById("context_openTabInWindow").disabled =
@@ -8607,6 +8710,7 @@ var TabContextMenu = {
@@ -8607,6 +8709,7 @@ var TabContextMenu = {
if (this.contextTab.multiselected) {
gBrowser.removeMultiSelectedTabs();
} else {