Merge pull request #9289 from electron/dont-allow-webpreferences-option-setting

Don't allow webPreferences to be overridden in features string
This commit is contained in:
Kevin Sawicki 2017-04-26 12:36:51 -07:00 committed by GitHub
commit 8460a580b9
2 changed files with 12 additions and 0 deletions

View file

@ -202,6 +202,10 @@ ipcMain.on('ELECTRON_GUEST_WINDOW_MANAGER_WINDOW_OPEN', (event, url, frameName,
if (value === undefined) {
additionalFeatures.push(key)
} else {
// Don't allow webPreferences to be set since it must be an object
// that cannot be directly overridden
if (key === 'webPreferences') return
if (webPreferences.includes(key)) {
if (options.webPreferences == null) {
options.webPreferences = {}

View file

@ -391,6 +391,14 @@ describe('chromium feature', function () {
})
b = window.open('', '__proto__')
})
it('does not throw an exception when the features include webPreferences', function () {
let b
assert.doesNotThrow(function () {
b = window.open('', '', 'webPreferences=')
})
b.close()
})
})
describe('window.opener', function () {