diff --git a/src/browser/components/tabbrowser/content/tabbrowser-js.patch b/src/browser/components/tabbrowser/content/tabbrowser-js.patch index e3d9a370..858c3788 100644 --- a/src/browser/components/tabbrowser/content/tabbrowser-js.patch +++ b/src/browser/components/tabbrowser/content/tabbrowser-js.patch @@ -1,5 +1,5 @@ diff --git a/browser/components/tabbrowser/content/tabbrowser.js b/browser/components/tabbrowser/content/tabbrowser.js -index 5f406ea5d09273c9b70b84eee24c6267f88692f8..c4fa57b30e48c9364bf252e7f1f62ae9c6fa3b40 100644 +index 5f406ea5d09273c9b70b84eee24c6267f88692f8..22d077e528387a6fbe59a170784dd8caa0c65b26 100644 --- a/browser/components/tabbrowser/content/tabbrowser.js +++ b/browser/components/tabbrowser/content/tabbrowser.js @@ -424,11 +424,67 @@ @@ -565,7 +565,7 @@ index 5f406ea5d09273c9b70b84eee24c6267f88692f8..c4fa57b30e48c9364bf252e7f1f62ae9 if (unloadBlocked) { return; } -@@ -5159,7 +5324,7 @@ +@@ -5159,13 +5324,13 @@ !excludeTabs.has(aTab.owner) && Services.prefs.getBoolPref("browser.tabs.selectOwnerOnClose") ) { @@ -574,6 +574,13 @@ index 5f406ea5d09273c9b70b84eee24c6267f88692f8..c4fa57b30e48c9364bf252e7f1f62ae9 } // Try to find a remaining tab that comes after the given tab + let remainingTabs = Array.prototype.filter.call( + this.visibleTabs, +- tab => !excludeTabs.has(tab) ++ tab => !excludeTabs.has(tab) && ZenWorkspaces._shouldChangeToTab(tab) + ); + + let tab = this.tabContainer.findNextTab(aTab, { @@ -5181,7 +5346,7 @@ } diff --git a/src/zen/workspaces/ZenWorkspaces.mjs b/src/zen/workspaces/ZenWorkspaces.mjs index 833c980d..4321d310 100644 --- a/src/zen/workspaces/ZenWorkspaces.mjs +++ b/src/zen/workspaces/ZenWorkspaces.mjs @@ -1813,7 +1813,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature { } _shouldChangeToTab(aTab) { - return !(aTab.hasAttribute('zen-essential') || (aTab.pinned && aTab.hasAttribute('pending'))); + return !(aTab?.hasAttribute('zen-essential') || (aTab?.pinned && aTab?.hasAttribute('pending'))); } async _handleTabSelection(window, onInit, containerId, workspaces, previousWorkspaceId, prevTabUsed) { @@ -2182,7 +2182,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature { } findTabToBlur(tab) { - if (!this._shouldChangeToTab(tab) && this._emptyTab) { + if ((!this._shouldChangeToTab(tab) || !tab) && this._emptyTab) { return this._emptyTab; } return tab;