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:
commit
8460a580b9
2 changed files with 12 additions and 0 deletions
|
@ -202,6 +202,10 @@ ipcMain.on('ELECTRON_GUEST_WINDOW_MANAGER_WINDOW_OPEN', (event, url, frameName,
|
||||||
if (value === undefined) {
|
if (value === undefined) {
|
||||||
additionalFeatures.push(key)
|
additionalFeatures.push(key)
|
||||||
} else {
|
} 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 (webPreferences.includes(key)) {
|
||||||
if (options.webPreferences == null) {
|
if (options.webPreferences == null) {
|
||||||
options.webPreferences = {}
|
options.webPreferences = {}
|
||||||
|
|
|
@ -391,6 +391,14 @@ describe('chromium feature', function () {
|
||||||
})
|
})
|
||||||
b = window.open('', '__proto__')
|
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 () {
|
describe('window.opener', function () {
|
||||||
|
|
Loading…
Reference in a new issue