Guard against no devtools web contents
This commit is contained in:
parent
03263bb5b6
commit
820fb3b82b
1 changed files with 6 additions and 3 deletions
|
@ -138,14 +138,17 @@ BrowserWindow.getFocusedWindow = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
BrowserWindow.fromWebContents = (webContents) => {
|
BrowserWindow.fromWebContents = (webContents) => {
|
||||||
for (let window of BrowserWindow.getAllWindows()) {
|
for (const window of BrowserWindow.getAllWindows()) {
|
||||||
if (window.webContents.equal(webContents)) return window
|
if (window.webContents.equal(webContents)) return window
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BrowserWindow.fromDevToolsWebContents = (webContents) => {
|
BrowserWindow.fromDevToolsWebContents = (webContents) => {
|
||||||
for (let window of BrowserWindow.getAllWindows()) {
|
for (const window of BrowserWindow.getAllWindows()) {
|
||||||
if (window.devToolsWebContents.equal(webContents)) return window
|
const {devToolsWebContents} = window
|
||||||
|
if (devToolsWebContents != null && devToolsWebContents.equal(webContents)) {
|
||||||
|
return window
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue