Add cross-origin frame webview spec
This commit is contained in:
parent
36989e19f8
commit
9f49b71b89
2 changed files with 10 additions and 1 deletions
|
@ -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)
|
||||
|
|
|
@ -1686,6 +1686,15 @@ describe('<webview> 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/')
|
||||
|
|
Loading…
Reference in a new issue