Skip to content

Commit 7eaebe0

Browse files
t57serCheng Zhao
and
Cheng Zhao
authored
fix: add isDestroyed check (#31208)
* Added isDestroyed check fix: electron/electron#31196 * fix: unregister frame name Unregister the frame name so that we do not accidentally unregister the wrong window later on in case there is a timing issue with the events * fix; check if webContents is destroyed * fix: check if window/webContents is destroyed Co-authored-by: Cheng Zhao <[email protected]> Co-authored-by: Cheng Zhao <[email protected]>
1 parent 14736c5 commit 7eaebe0

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/browser/guest-window-manager.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,13 @@ export function openGuestWindow ({ event, embedder, guest, referrer, disposition
6565
// https://html.spec.whatwg.org/multipage/window-object.html#apis-for-creating-and-navigating-browsing-contexts-by-name
6666
const existingWindow = getGuestWindowByFrameName(frameName);
6767
if (existingWindow) {
68-
existingWindow.loadURL(url);
69-
return existingWindow;
68+
if (existingWindow.isDestroyed() || existingWindow.webContents.isDestroyed()) {
69+
// FIXME(t57ser): The webContents is destroyed for some reason, unregister the frame name
70+
unregisterFrameName(frameName);
71+
} else {
72+
existingWindow.loadURL(url);
73+
return existingWindow;
74+
}
7075
}
7176

7277
const window = new BrowserWindow({

0 commit comments

Comments
 (0)