Open about:blank when window.open is called with no URL

This commit is contained in:
Kevin Sawicki 2016-09-08 16:10:21 -07:00
parent 638c96345d
commit 9829baed46
2 changed files with 23 additions and 3 deletions

View file

@ -250,8 +250,7 @@ describe('chromium feature', function () {
it('defines a window.location setter', function (done) {
// Load a page that definitely won't redirect
var b
b = window.open('about:blank')
var b = window.open('about:blank')
webContents.fromId(b.guestId).once('did-finish-load', function () {
// When it loads, redirect
b.location = 'file://' + fixtures + '/pages/base-page.html'
@ -262,6 +261,23 @@ describe('chromium feature', function () {
})
})
})
it('open a blank page when no URL is specified', function (done) {
let b = window.open()
webContents.fromId(b.guestId).once('did-finish-load', function () {
const {location} = b
b.close()
assert.equal(location, 'about:blank')
let c = window.open('')
webContents.fromId(c.guestId).once('did-finish-load', function () {
const {location} = c
c.close()
assert.equal(location, 'about:blank')
done()
})
})
})
})
describe('window.opener', function () {