Fixed " Closing Tabs opened from SidePanel renders the browser unusable" (closes https://github.com/zen-browser/desktop/issues/1966)

This commit is contained in:
mr. M
2024-10-11 23:02:54 +02:00
parent 2082079c7e
commit 2ee66b0b22
2 changed files with 25 additions and 1 deletions

View File

@@ -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);