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/')