From 145e40c2f6537f4ca72383937288bac99b828d72 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Fri, 25 Nov 2016 09:47:28 -0800 Subject: [PATCH] Add more origin comparison specs --- spec/chromium-spec.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/spec/chromium-spec.js b/spec/chromium-spec.js index e0bdd1861d55..1a39edd296f9 100644 --- a/spec/chromium-spec.js +++ b/spec/chromium-spec.js @@ -345,6 +345,15 @@ describe('chromium feature', function () { 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) { listener = function (event) { assert.equal(event.data, location.href) @@ -397,6 +406,24 @@ describe('chromium feature', function () { 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) { webview = new WebView() webview.addEventListener('console-message', function (e) {