mirror of
https://github.com/zen-browser/desktop.git
synced 2025-10-04 17:06:35 +00:00
fix: Tab siwtcher crashing zen if no active tabs exist, b=(closes #7865), c=tabs, workspaces
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
diff --git a/browser/components/tabbrowser/content/browser-ctrlTab.js b/browser/components/tabbrowser/content/browser-ctrlTab.js
|
||||
index 6753641cb579032306453be3f5054d7bc7661e8c..e0eda8d77637334ca30ee1842057cb43b4af2c21 100644
|
||||
index 6753641cb579032306453be3f5054d7bc7661e8c..436ee8940c8a73d238a7aed10768a0a752a3f119 100644
|
||||
--- a/browser/components/tabbrowser/content/browser-ctrlTab.js
|
||||
+++ b/browser/components/tabbrowser/content/browser-ctrlTab.js
|
||||
@@ -252,7 +252,7 @@ var ctrlTab = {
|
||||
@@ -20,6 +20,15 @@ index 6753641cb579032306453be3f5054d7bc7661e8c..e0eda8d77637334ca30ee1842057cb43
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -483,7 +483,7 @@ var ctrlTab = {
|
||||
},
|
||||
|
||||
open: function ctrlTab_open() {
|
||||
- if (this.isOpen) {
|
||||
+ if (this.isOpen || !this.tabCount) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -761,7 +761,7 @@ var ctrlTab = {
|
||||
_initRecentlyUsedTabs() {
|
||||
this._recentlyUsedTabs = Array.prototype.filter.call(
|
||||
|
@@ -1274,5 +1274,6 @@
|
||||
&[hidden='true'] {
|
||||
visibility: hidden;
|
||||
pointer-events: none;
|
||||
position: fixed;
|
||||
}
|
||||
}
|
||||
|
@@ -1809,6 +1809,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
// Second pass: Handle tab selection
|
||||
this.tabContainer._invalidateCachedTabs();
|
||||
const tabToSelect = await this._handleTabSelection(window, onInit, previousWorkspace.uuid);
|
||||
gBrowser.warmupTab(tabToSelect);
|
||||
|
||||
// Update UI and state
|
||||
const previousWorkspaceIndex = workspaces.workspaces.findIndex((w) => w.uuid === previousWorkspace.uuid);
|
||||
@@ -2771,8 +2772,12 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
}
|
||||
|
||||
try {
|
||||
const currentWorkspace = this.getActiveWorkspaceFromCache();
|
||||
// Check if we need to change workspace
|
||||
if (!tab.hasAttribute('zen-essential') && tab.getAttribute('zen-workspace-id') !== this.activeWorkspace) {
|
||||
if (
|
||||
tab.getAttribute('zen-workspace-id') !== this.activeWorkspace ||
|
||||
(currentWorkspace.containerTabId !== tab.getAttribute('usercontextid') && this.containerSpecificEssentials)
|
||||
) {
|
||||
// Use a mutex-like approach to prevent concurrent workspace changes
|
||||
if (this._workspaceChangeInProgress) {
|
||||
console.warn('Workspace change already in progress, deferring tab switch');
|
||||
@@ -2781,7 +2786,10 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
|
||||
this._workspaceChangeInProgress = true;
|
||||
try {
|
||||
await this.changeWorkspace({ uuid: tab.getAttribute('zen-workspace-id') });
|
||||
await this.changeWorkspace({
|
||||
uuid: tab.getAttribute('zen-workspace-id'),
|
||||
containerTabId: tab.getAttribute('usercontextid'),
|
||||
});
|
||||
} finally {
|
||||
this._workspaceChangeInProgress = false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user