diff --git a/spec/fixtures/api/native-window-open-cross-origin.html b/spec/fixtures/api/native-window-open-cross-origin.html index 4445d8d51a..c92683c0c3 100644 --- a/spec/fixtures/api/native-window-open-cross-origin.html +++ b/spec/fixtures/api/native-window-open-cross-origin.html @@ -7,7 +7,7 @@ try { if (popup.location.toString() !== 'about:blank') { clearInterval(intervalID) - ipcRenderer.send('answer', 'did not throw error') + ipcRenderer.send('answer', `Did not throw error accessing location: ${popup.location}`) } } catch (error) { clearInterval(intervalID) diff --git a/spec/webview-spec.js b/spec/webview-spec.js index 4c1540931b..180da5b80c 100644 --- a/spec/webview-spec.js +++ b/spec/webview-spec.js @@ -1686,6 +1686,15 @@ describe(' tag', function () { document.body.appendChild(webview) }) + it('blocks accessing cross-origin frames', (done) => { + ipcMain.once('answer', (event, content) => { + assert.equal(content, 'Blocked a frame with origin "file://" from accessing a cross-origin frame.') + done() + }) + webview.src = 'file://' + path.join(fixtures, 'api', 'native-window-open-cross-origin.html') + document.body.appendChild(webview) + }) + it('emits a new-window event', (done) => { webview.addEventListener('new-window', function (e) { assert.equal(e.url, 'http://host/')