From 2ee66b0b2289372ff1f8d47461d4c622656d1c0c Mon Sep 17 00:00:00 2001 From: "mr. M" Date: Fri, 11 Oct 2024 23:02:54 +0200 Subject: [PATCH] Fixed " Closing Tabs opened from SidePanel renders the browser unusable" (closes https://github.com/zen-browser/desktop/issues/1966) --- src/browser/base/content/zen-components | 2 +- .../PictureInPicture-sys-mjs.patch | 24 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 src/toolkit/components/pictureinpicture/PictureInPicture-sys-mjs.patch diff --git a/src/browser/base/content/zen-components b/src/browser/base/content/zen-components index c86b344c1..0a23df721 160000 --- a/src/browser/base/content/zen-components +++ b/src/browser/base/content/zen-components @@ -1 +1 @@ -Subproject commit c86b344c1786f3181ef62f8b1d1d19d9b2c2c7dd +Subproject commit 0a23df721efd4c20489f8a6a05d2ce08508eff2b diff --git a/src/toolkit/components/pictureinpicture/PictureInPicture-sys-mjs.patch b/src/toolkit/components/pictureinpicture/PictureInPicture-sys-mjs.patch new file mode 100644 index 000000000..d0a889937 --- /dev/null +++ b/src/toolkit/components/pictureinpicture/PictureInPicture-sys-mjs.patch @@ -0,0 +1,24 @@ +diff --git a/toolkit/components/pictureinpicture/PictureInPicture.sys.mjs b/toolkit/components/pictureinpicture/PictureInPicture.sys.mjs +index 27f7208ac689c51443a0a6ffafd77f89b71d0030..dcd664f85e27618e23118a80af54a6400b12b806 100644 +--- a/toolkit/components/pictureinpicture/PictureInPicture.sys.mjs ++++ b/toolkit/components/pictureinpicture/PictureInPicture.sys.mjs +@@ -471,8 +471,8 @@ export var PictureInPicture = { + return; + } + +- let gBrowser = browser.getTabBrowser(); +- let tab = gBrowser.getTabForBrowser(browser); ++ let gBrowser = browser?.ownerGlobal?.gBrowser; ++ let tab = browser?.ownerGlobal?.gZenBrowserManagerSidebar.getTabForBrowser(browser) ?? gBrowser.getTabForBrowser(browser); + + // focus the tab's window + tab.ownerGlobal.focus(); +@@ -875,7 +875,7 @@ export var PictureInPicture = { + win.setIsMutedState(videoData.isMuted); + + // set attribute which shows pip icon in tab +- let tab = parentWin.gBrowser.getTabForBrowser(browser); ++ let tab = parentWin.gBrowser.getTabForBrowser(browser) ?? parentWin.gZenBrowserManagerSidebar.getTabForBrowser(browser);; + tab.setAttribute("pictureinpicture", true); + + this.setUrlbarPipIconActive(parentWin);