Open about:blank when window.open is called with no URL
This commit is contained in:
parent
638c96345d
commit
9829baed46
2 changed files with 23 additions and 3 deletions
|
@ -139,7 +139,11 @@ window.open = function (url, frameName, features) {
|
|||
}
|
||||
|
||||
// Resolve relative urls.
|
||||
if (url == null || url == '') {
|
||||
url = 'about:blank'
|
||||
} else {
|
||||
url = resolveURL(url)
|
||||
}
|
||||
for (j = 0, len1 = ints.length; j < len1; j++) {
|
||||
name = ints[j]
|
||||
if (options[name] != null) {
|
||||
|
|
|
@ -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 () {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue