From 2cb752e3deb95bcdb84eac449b5943428f8501b4 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 10 Dec 2015 16:49:23 -0800 Subject: [PATCH] Add failing spec for event origin --- spec/chromium-spec.coffee | 13 +++++++++++++ spec/fixtures/pages/window-open-postMessage.html | 9 +++++++++ 2 files changed, 22 insertions(+) create mode 100644 spec/fixtures/pages/window-open-postMessage.html diff --git a/spec/chromium-spec.coffee b/spec/chromium-spec.coffee index 211de34..2b768f6 100644 --- a/spec/chromium-spec.coffee +++ b/spec/chromium-spec.coffee @@ -115,6 +115,19 @@ describe 'chromium feature', -> window.addEventListener 'message', listener b = window.open url, '', 'show=no' + describe 'window.postMessage', -> + it 'sets the origin correctly', (done) -> + listener = (event) -> + window.removeEventListener 'message', listener + b.close() + assert.equal event.data, 'file://testing' + assert.equal event.origin, 'file://' + done() + window.addEventListener 'message', listener + b = window.open "file://#{fixtures}/pages/window-open-postMessage.html", '', 'show=no' + BrowserWindow.fromId(b.guestId).webContents.once 'did-finish-load', -> + b.postMessage('testing', '*') + describe 'window.opener.postMessage', -> it 'sets source and origin correctly', (done) -> listener = (event) -> diff --git a/spec/fixtures/pages/window-open-postMessage.html b/spec/fixtures/pages/window-open-postMessage.html new file mode 100644 index 0000000..e547fa2 --- /dev/null +++ b/spec/fixtures/pages/window-open-postMessage.html @@ -0,0 +1,9 @@ + + + + + -- 2.7.4