chore: warn memory leak when using nativeWindowOpen with nodeIntegration

This commit is contained in:
Cheng Zhao 2018-10-16 20:12:53 +09:00
parent 4a5d2117ba
commit 714f3ffd29

View file

@ -48,6 +48,15 @@ BrowserWindow.prototype._init = function () {
return return
} }
if (webContents.getLastWebPreferences().nodeIntegration === true) {
const message =
'Enabling Node.js integration in child windows opened with the ' +
'"nativeWindowOpen" option will cause memory leaks, please turn off ' +
'the "nodeIntegration" option.\\n' +
'See https://github.com/electron/electron/pull/15076 for more.'
this.webContents.executeJavaScript(`console.warn('${message}')`)
}
let {url, frameName} = urlFrameName let {url, frameName} = urlFrameName
v8Util.deleteHiddenValue(webContents, 'url-framename') v8Util.deleteHiddenValue(webContents, 'url-framename')
const options = { const options = {