Add more origin comparison specs
This commit is contained in:
parent
41dea03007
commit
145e40c2f6
1 changed files with 27 additions and 0 deletions
|
@ -345,6 +345,15 @@ describe('chromium feature', function () {
|
||||||
w = window.open(url, '', 'show=no')
|
w = window.open(url, '', 'show=no')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('works when origin matches', function (done) {
|
||||||
|
listener = function (event) {
|
||||||
|
assert.equal(event.data, location.href)
|
||||||
|
done()
|
||||||
|
}
|
||||||
|
window.addEventListener('message', listener)
|
||||||
|
w = window.open(`file://${fixtures}/pages/window-opener-location.html`, '', 'show=no')
|
||||||
|
})
|
||||||
|
|
||||||
it('works when origin does not match opener but has node integration', function (done) {
|
it('works when origin does not match opener but has node integration', function (done) {
|
||||||
listener = function (event) {
|
listener = function (event) {
|
||||||
assert.equal(event.data, location.href)
|
assert.equal(event.data, location.href)
|
||||||
|
@ -397,6 +406,24 @@ describe('chromium feature', function () {
|
||||||
document.body.appendChild(webview)
|
document.body.appendChild(webview)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('works when origin matches', function (done) {
|
||||||
|
webview = new WebView()
|
||||||
|
webview.addEventListener('console-message', function (e) {
|
||||||
|
assert.equal(e.message, webview.src)
|
||||||
|
done()
|
||||||
|
})
|
||||||
|
webview.setAttribute('allowpopups', 'on')
|
||||||
|
webview.src = url.format({
|
||||||
|
pathname: srcPath,
|
||||||
|
protocol: 'file',
|
||||||
|
query: {
|
||||||
|
p: pageURL
|
||||||
|
},
|
||||||
|
slashes: true
|
||||||
|
})
|
||||||
|
document.body.appendChild(webview)
|
||||||
|
})
|
||||||
|
|
||||||
it('works when origin does not match opener but has node integration', function (done) {
|
it('works when origin does not match opener but has node integration', function (done) {
|
||||||
webview = new WebView()
|
webview = new WebView()
|
||||||
webview.addEventListener('console-message', function (e) {
|
webview.addEventListener('console-message', function (e) {
|
||||||
|
|
Loading…
Reference in a new issue