diff --git a/spec/chromium-spec.coffee b/spec/chromium-spec.coffee index c594a97f3b83..d09a021db9f9 100644 --- a/spec/chromium-spec.coffee +++ b/spec/chromium-spec.coffee @@ -36,11 +36,20 @@ describe 'chromium feature', -> describe 'window.open', -> it 'returns a BrowserWindowProxy object', -> - b = window.open 'about:blank', 'test', 'show=no' + b = window.open 'about:blank', '', 'show=no' assert.equal b.closed, false assert.equal b.constructor.name, 'BrowserWindowProxy' b.close() + it 'accepts "node-integration" as feature', (done) -> + listener = (event) -> + window.removeEventListener 'message', listener + b.close() + assert.equal event.data, 'undefined' + done() + window.addEventListener 'message', listener + b = window.open "file://#{fixtures}/pages/window-opener-node.html", '', 'node-integration=no,show=no' + describe 'window.opener', -> ipc = remote.require 'ipc' url = "file://#{fixtures}/pages/window-opener.html" @@ -58,19 +67,21 @@ describe 'chromium feature', -> w.loadUrl url it 'is not null for window opened by window.open', (done) -> - b = window.open url, 'test2', 'show=no' + b = window.open url, '', 'show=no' ipc.on 'opener', (event, opener) -> 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) -> + listener = (event) -> + window.removeEventListener 'message', listener b.close() assert.equal event.source.guestId, b.guestId assert.equal event.origin, 'file://' done() + window.addEventListener 'message', listener + b = window.open "file://#{fixtures}/pages/window-opener-postMessage.html", '', 'show=no' describe 'creating a Uint8Array under browser side', -> it 'does not crash', -> diff --git a/spec/fixtures/pages/window-opener-node.html b/spec/fixtures/pages/window-opener-node.html new file mode 100644 index 000000000000..118603c82d3b --- /dev/null +++ b/spec/fixtures/pages/window-opener-node.html @@ -0,0 +1,7 @@ + +
+ + +