From cee050709017144e567c7b6ca1494e56ddc93ade Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Fri, 21 Apr 2017 10:58:47 -0700 Subject: [PATCH] Add failing spec for inheriting Javascript web preference --- spec/chromium-spec.js | 25 +++++++++++++++++++ spec/fixtures/pages/window-no-javascript.html | 12 +++++++++ 2 files changed, 37 insertions(+) create mode 100644 spec/fixtures/pages/window-no-javascript.html diff --git a/spec/chromium-spec.js b/spec/chromium-spec.js index 4c5b85521ac2..977f25e10359 100644 --- a/spec/chromium-spec.js +++ b/spec/chromium-spec.js @@ -229,6 +229,31 @@ describe('chromium feature', function () { b = window.open(windowUrl, '', 'nodeIntegration=no,show=no') }) + it('disables JavaScript when it is disabled on the parent window', function (done) { + var b + app.once('web-contents-created', (event, contents) => { + contents.once('did-finish-load', () => { + app.once('browser-window-created', (event, window) => { + const preferences = window.webContents.getWebPreferences() + assert.equal(preferences.javascript, false) + window.destroy() + b.close() + done() + }) + // Click link on page + contents.sendInputEvent({type: 'mouseDown', clickCount: 1, x: 1, y: 1}) + contents.sendInputEvent({type: 'mouseUp', clickCount: 1, x: 1, y: 1}) + }) + }) + + var windowUrl = require('url').format({ + pathname: `${fixtures}/pages/window-no-javascript.html`, + protocol: 'file', + slashes: true + }) + b = window.open(windowUrl, '', 'javascript=no,show=no') + }) + it('does not override child options', function (done) { var b, size size = { diff --git a/spec/fixtures/pages/window-no-javascript.html b/spec/fixtures/pages/window-no-javascript.html new file mode 100644 index 000000000000..9c38c9e0bba4 --- /dev/null +++ b/spec/fixtures/pages/window-no-javascript.html @@ -0,0 +1,12 @@ + + + + +CLICK + +