Remove use of now private guestId
This commit is contained in:
parent
fbcbfbda6a
commit
37b7dda3c5
2 changed files with 36 additions and 28 deletions
|
@ -300,34 +300,43 @@ describe('chromium feature', function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
it('defines a window.location setter', function (done) {
|
it('defines a window.location setter', function (done) {
|
||||||
// Load a page that definitely won't redirect
|
let b
|
||||||
var b = window.open('about:blank')
|
app.once('browser-window-created', (event, {webContents}) => {
|
||||||
webContents.fromId(b.guestId).once('did-finish-load', function () {
|
webContents.once('did-finish-load', function () {
|
||||||
// When it loads, redirect
|
// When it loads, redirect
|
||||||
b.location = 'file://' + fixtures + '/pages/base-page.html'
|
b.location = 'file://' + fixtures + '/pages/base-page.html'
|
||||||
webContents.fromId(b.guestId).once('did-finish-load', function () {
|
webContents.once('did-finish-load', function () {
|
||||||
// After our second redirect, cleanup and callback
|
// After our second redirect, cleanup and callback
|
||||||
b.close()
|
b.close()
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
// Load a page that definitely won't redirect
|
||||||
|
b = window.open('about:blank')
|
||||||
|
})
|
||||||
|
|
||||||
it('open a blank page when no URL is specified', function (done) {
|
it('open a blank page when no URL is specified', function (done) {
|
||||||
let b = window.open()
|
let b
|
||||||
webContents.fromId(b.guestId).once('did-finish-load', function () {
|
app.once('browser-window-created', (event, {webContents}) => {
|
||||||
|
webContents.once('did-finish-load', function () {
|
||||||
const {location} = b
|
const {location} = b
|
||||||
b.close()
|
b.close()
|
||||||
assert.equal(location, 'about:blank')
|
assert.equal(location, 'about:blank')
|
||||||
|
|
||||||
let c = window.open('')
|
let c
|
||||||
webContents.fromId(c.guestId).once('did-finish-load', function () {
|
app.once('browser-window-created', (event, {webContents}) => {
|
||||||
|
webContents.once('did-finish-load', function () {
|
||||||
const {location} = c
|
const {location} = c
|
||||||
c.close()
|
c.close()
|
||||||
assert.equal(location, 'about:blank')
|
assert.equal(location, 'about:blank')
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
c = window.open('')
|
||||||
|
})
|
||||||
|
})
|
||||||
|
b = window.open()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -492,8 +501,7 @@ describe('chromium feature', function () {
|
||||||
|
|
||||||
describe('window.postMessage', function () {
|
describe('window.postMessage', function () {
|
||||||
it('sets the source and origin correctly', function (done) {
|
it('sets the source and origin correctly', function (done) {
|
||||||
var b, sourceId
|
var b
|
||||||
sourceId = remote.getCurrentWindow().id
|
|
||||||
listener = function (event) {
|
listener = function (event) {
|
||||||
window.removeEventListener('message', listener)
|
window.removeEventListener('message', listener)
|
||||||
b.close()
|
b.close()
|
||||||
|
@ -501,16 +509,17 @@ describe('chromium feature', function () {
|
||||||
assert.equal(message.data, 'testing')
|
assert.equal(message.data, 'testing')
|
||||||
assert.equal(message.origin, 'file://')
|
assert.equal(message.origin, 'file://')
|
||||||
assert.equal(message.sourceEqualsOpener, true)
|
assert.equal(message.sourceEqualsOpener, true)
|
||||||
assert.equal(message.sourceId, sourceId)
|
|
||||||
assert.equal(event.origin, 'file://')
|
assert.equal(event.origin, 'file://')
|
||||||
done()
|
done()
|
||||||
}
|
}
|
||||||
window.addEventListener('message', listener)
|
window.addEventListener('message', listener)
|
||||||
b = window.open('file://' + fixtures + '/pages/window-open-postMessage.html', '', 'show=no')
|
app.once('browser-window-created', (event, {webContents}) => {
|
||||||
webContents.fromId(b.guestId).once('did-finish-load', function () {
|
webContents.once('did-finish-load', function () {
|
||||||
b.postMessage('testing', '*')
|
b.postMessage('testing', '*')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
b = window.open('file://' + fixtures + '/pages/window-open-postMessage.html', '', 'show=no')
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('window.opener.postMessage', function () {
|
describe('window.opener.postMessage', function () {
|
||||||
|
|
|
@ -5,8 +5,7 @@
|
||||||
window.opener.postMessage(JSON.stringify({
|
window.opener.postMessage(JSON.stringify({
|
||||||
origin: e.origin,
|
origin: e.origin,
|
||||||
data: e.data,
|
data: e.data,
|
||||||
sourceEqualsOpener: e.source === window.opener,
|
sourceEqualsOpener: e.source === window.opener
|
||||||
sourceId: e.source.guestId
|
|
||||||
}), '*');
|
}), '*');
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in a new issue