spec: window.opener.postMessage should set source and origin

This commit is contained in:
Cheng Zhao 2015-09-01 12:15:00 +08:00
parent dddb598818
commit c70513f7ce
2 changed files with 16 additions and 0 deletions

View file

@ -63,6 +63,15 @@ describe 'chromium feature', ->
b.close()
done(if opener isnt null then undefined else opener)
describe 'window.opener.postMessage', ->
it 'sets source and origin correctly', (done) ->
b = window.open "file://#{fixtures}/pages/window-opener-postMessage.html", 'test', 'show=no'
window.addEventListener 'message', (event) ->
b.close()
assert.equal event.source.guestId, b.guestId
assert.equal event.origin, 'file://'
done()
describe 'creating a Uint8Array under browser side', ->
it 'does not crash', ->
RUint8Array = remote.getGlobal 'Uint8Array'

View file

@ -0,0 +1,7 @@
<html>
<body>
<script type="text/javascript" charset="utf-8">
window.opener.postMessage('message', '*');
</script>
</body>
</html>