docs: deprecation warning for using nativeWindowOpen with nodeIntegration

This commit is contained in:
Cheng Zhao
2018-10-16 20:12:53 +09:00
parent 0c09199f77
commit df70487f80
2 changed files with 14 additions and 0 deletions

View File

@@ -18,6 +18,9 @@ The following `webPreferences` option default values are deprecated in favor of
| `nodeIntegration` | `true` | `false` |
| `webviewTag` | `nodeIntegration` if set else `true` | `false` |
## `nativeWindowOpen`
Child windows opened with the `nativeWindowOpen` option will always have Node.js integration disabled.
# Planned Breaking API Changes (4.0)

View File

@@ -49,6 +49,17 @@ BrowserWindow.prototype._init = function () {
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' +
'From 5.x child windows opened with the "nativeWindowOpen" option ' +
'will always have Node.js integration disabled.\\n' +
'See https://github.com/electron/electron/pull/15076 for more.'
this.webContents.executeJavaScript(`console.warn('${message}')`)
}
const { url, frameName } = urlFrameName
v8Util.deleteHiddenValue(webContents, 'url-framename')
const options = {