fix: add isDestroyed check (#31208)
* Added isDestroyed check fix: https://github.com/electron/electron/issues/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 <github@zcbenz.com> Co-authored-by: Cheng Zhao <github@zcbenz.com>
This commit is contained in:
parent
14736c5f30
commit
7eaebe0bd6
1 changed files with 7 additions and 2 deletions
|
@ -65,8 +65,13 @@ export function openGuestWindow ({ event, embedder, guest, referrer, disposition
|
||||||
// https://html.spec.whatwg.org/multipage/window-object.html#apis-for-creating-and-navigating-browsing-contexts-by-name
|
// https://html.spec.whatwg.org/multipage/window-object.html#apis-for-creating-and-navigating-browsing-contexts-by-name
|
||||||
const existingWindow = getGuestWindowByFrameName(frameName);
|
const existingWindow = getGuestWindowByFrameName(frameName);
|
||||||
if (existingWindow) {
|
if (existingWindow) {
|
||||||
existingWindow.loadURL(url);
|
if (existingWindow.isDestroyed() || existingWindow.webContents.isDestroyed()) {
|
||||||
return existingWindow;
|
// FIXME(t57ser): The webContents is destroyed for some reason, unregister the frame name
|
||||||
|
unregisterFrameName(frameName);
|
||||||
|
} else {
|
||||||
|
existingWindow.loadURL(url);
|
||||||
|
return existingWindow;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const window = new BrowserWindow({
|
const window = new BrowserWindow({
|
||||||
|
|
Loading…
Reference in a new issue