mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
Guard against no devtools web contents
This commit is contained in:
@@ -138,14 +138,17 @@ BrowserWindow.getFocusedWindow = () => {
|
||||
}
|
||||
|
||||
BrowserWindow.fromWebContents = (webContents) => {
|
||||
for (let window of BrowserWindow.getAllWindows()) {
|
||||
for (const window of BrowserWindow.getAllWindows()) {
|
||||
if (window.webContents.equal(webContents)) return window
|
||||
}
|
||||
}
|
||||
|
||||
BrowserWindow.fromDevToolsWebContents = (webContents) => {
|
||||
for (let window of BrowserWindow.getAllWindows()) {
|
||||
if (window.devToolsWebContents.equal(webContents)) return window
|
||||
for (const window of BrowserWindow.getAllWindows()) {
|
||||
const {devToolsWebContents} = window
|
||||
if (devToolsWebContents != null && devToolsWebContents.equal(webContents)) {
|
||||
return window
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user