From 7726c7c6c4eb6cf037eef207958705578ad2271a Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 25 Apr 2017 14:19:59 -0700 Subject: [PATCH 1/2] Add spec for webPreferences in features string --- spec/chromium-spec.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/spec/chromium-spec.js b/spec/chromium-spec.js index 1b88d78e2ab3..700983bb5ae9 100644 --- a/spec/chromium-spec.js +++ b/spec/chromium-spec.js @@ -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 () { From 507f60e33e656248aeb40cc0d5fd8065a7dde5e4 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 25 Apr 2017 14:20:39 -0700 Subject: [PATCH 2/2] Don't allow webPreferences to be overrideden in features string --- lib/browser/guest-window-manager.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/browser/guest-window-manager.js b/lib/browser/guest-window-manager.js index 33ec15a101d4..e668a3114a5f 100644 --- a/lib/browser/guest-window-manager.js +++ b/lib/browser/guest-window-manager.js @@ -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 = {}