Add failing spec for targetOrigin handling
This commit is contained in:
parent
9e0c308b09
commit
3c58d50f87
2 changed files with 52 additions and 0 deletions
|
@ -1,4 +1,5 @@
|
|||
const assert = require('assert')
|
||||
const fs = require('fs')
|
||||
const http = require('http')
|
||||
const path = require('path')
|
||||
const ws = require('ws')
|
||||
|
@ -618,6 +619,39 @@ describe('chromium feature', function () {
|
|||
})
|
||||
document.body.appendChild(webview)
|
||||
})
|
||||
|
||||
describe('targetOrigin argument', function () {
|
||||
let serverURL
|
||||
let server
|
||||
|
||||
beforeEach(function (done) {
|
||||
server = http.createServer(function (req, res) {
|
||||
res.writeHead(200)
|
||||
const filePath = path.join(fixtures, 'pages', 'window-opener-targetOrigin.html')
|
||||
res.end(fs.readFileSync(filePath, 'utf8'))
|
||||
})
|
||||
server.listen(0, '127.0.0.1', function () {
|
||||
serverURL = `http://127.0.0.1:${server.address().port}`
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
afterEach(function () {
|
||||
server.close()
|
||||
})
|
||||
|
||||
it('delivers messages that match the origin', function (done) {
|
||||
let b
|
||||
listener = function (event) {
|
||||
window.removeEventListener('message', listener)
|
||||
b.close()
|
||||
assert.equal(event.data, 'second message')
|
||||
done()
|
||||
}
|
||||
window.addEventListener('message', listener)
|
||||
b = window.open(serverURL, '', 'show=no')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('creating a Uint8Array under browser side', function () {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue