From a0571e3c72b2fcce592a4aa551ee525506ad568f Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 23 May 2017 15:56:06 -0700 Subject: [PATCH] Add failing spec for native window.open returning null without allowpopups --- .../api/native-window-open-no-allowpopups.html | 9 +++++++++ spec/webview-spec.js | 10 ++++++++++ 2 files changed, 19 insertions(+) create mode 100644 spec/fixtures/api/native-window-open-no-allowpopups.html diff --git a/spec/fixtures/api/native-window-open-no-allowpopups.html b/spec/fixtures/api/native-window-open-no-allowpopups.html new file mode 100644 index 000000000000..1e8fb7e796f5 --- /dev/null +++ b/spec/fixtures/api/native-window-open-no-allowpopups.html @@ -0,0 +1,9 @@ + + + + + diff --git a/spec/webview-spec.js b/spec/webview-spec.js index 3d517f0e7daa..4c1540931b14 100644 --- a/spec/webview-spec.js +++ b/spec/webview-spec.js @@ -1676,6 +1676,16 @@ describe(' tag', function () { document.body.appendChild(webview) }) + it('returns null from window.open when allowpopups is not set', (done) => { + webview.removeAttribute('allowpopups') + ipcMain.once('answer', (event, {windowOpenReturnedNull}) => { + assert.equal(windowOpenReturnedNull, true) + done() + }) + webview.src = 'file://' + path.join(fixtures, 'api', 'native-window-open-no-allowpopups.html') + document.body.appendChild(webview) + }) + it('emits a new-window event', (done) => { webview.addEventListener('new-window', function (e) { assert.equal(e.url, 'http://host/')