describe 'window.postMessage', ->
it 'sets the origin correctly', (done) ->
+ sourceId = remote.getCurrentWindow().id
listener = (event) ->
window.removeEventListener 'message', listener
b.close()
assert.equal message.data, 'testing'
assert.equal message.origin, 'file://'
assert.equal message.sourceEqualsOpener, true
+ assert.equal message.sourceId, sourceId
assert.equal event.origin, 'file://'
done()
window.addEventListener 'message', listener
var reply = JSON.stringify({
origin: e.origin,
data: e.data,
- sourceEqualsOpener: e.source === window.opener
+ sourceEqualsOpener: e.source === window.opener,
+ sourceId: e.source.guestId
})
window.opener.postMessage(reply, '*');
});