From 36aa7b0a209b192a832a83e01e35e837566093be Mon Sep 17 00:00:00 2001 From: "mr. m" <91018726+mr-cheffy@users.noreply.github.com> Date: Thu, 2 Apr 2026 16:10:18 +0200 Subject: [PATCH] gh-13038: Fixed trying to swap browsers that dont exist (gh-13051) --- src/zen/sessionstore/ZenWindowSync.sys.mjs | 5 ++++- src/zen/tabs/ZenPinnedTabManager.mjs | 19 ++++++++++--------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/zen/sessionstore/ZenWindowSync.sys.mjs b/src/zen/sessionstore/ZenWindowSync.sys.mjs index 95b6c8e70..564693dca 100644 --- a/src/zen/sessionstore/ZenWindowSync.sys.mjs +++ b/src/zen/sessionstore/ZenWindowSync.sys.mjs @@ -790,7 +790,10 @@ class nsZenWindowSync { // We *shouldn't* care about this scenario since the remoteness should be // the same anyways. if (!aOurTab.linkedBrowser || !aOtherTab.linkedBrowser) { - return true; + this.log( + `Cannot swap browsers between tabs ${aOurTab.id} and ${aOtherTab.id} because one of them doesn't have a linked browser` + ); + return false; } // Can't swap between chrome and content processes. if ( diff --git a/src/zen/tabs/ZenPinnedTabManager.mjs b/src/zen/tabs/ZenPinnedTabManager.mjs index 1e2d4fc3c..8a8e4e832 100644 --- a/src/zen/tabs/ZenPinnedTabManager.mjs +++ b/src/zen/tabs/ZenPinnedTabManager.mjs @@ -678,14 +678,15 @@ class nsZenPinnedTabManager extends nsZenDOMOperatedFeature { return tab; } let workspaceId; + if ( + !tab.hasAttribute("zen-essential") && + tab.getAttribute("zen-workspace-id") != gZenWorkspaces.activeWorkspace + ) { + workspaceId = gZenWorkspaces.activeWorkspace; + } if (tab.ownerGlobal !== window) { fromDifferentWindow = true; - if ( - !tab.hasAttribute("zen-essential") && - tab.getAttribute("zen-workspace-id") != - gZenWorkspaces.activeWorkspace - ) { - workspaceId = gZenWorkspaces.activeWorkspace; + if (workspaceId) { tab.ownerGlobal.gBrowser.selectedTab = tab.ownerGlobal.gBrowser._findTabToBlurTo(tab, movingTabs); tab.ownerGlobal.gZenWorkspaces.moveTabToWorkspace(tab, workspaceId); @@ -700,9 +701,9 @@ class nsZenPinnedTabManager extends nsZenDOMOperatedFeature { if (tab) { ++newIndex; } - if (workspaceId) { - tab.setAttribute("zen-workspace-id", workspaceId); - } + } + if (workspaceId) { + tab.setAttribute("zen-workspace-id", workspaceId); } return tab; });