mirror of
https://github.com/electron/electron.git
synced 2026-01-09 15:38:08 -05:00
Add failing spec for native window.open returning null without allowpopups
This commit is contained in:
9
spec/fixtures/api/native-window-open-no-allowpopups.html
vendored
Normal file
9
spec/fixtures/api/native-window-open-no-allowpopups.html
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
<html>
|
||||
<body>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
const {ipcRenderer} = require('electron')
|
||||
const popup = window.open()
|
||||
ipcRenderer.send('answer', {windowOpenReturnedNull: popup == null})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1676,6 +1676,16 @@ describe('<webview> 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/')
|
||||
|
||||
Reference in New Issue
Block a user