spec: node symbols should always be available in preload script

This commit is contained in:
Cheng Zhao 2015-09-14 16:05:58 +08:00
parent 3bd16a5ecd
commit baacc939f6
2 changed files with 15 additions and 0 deletions

View file

@ -0,0 +1,7 @@
setImmediate(function() {
try {
console.log([typeof process, typeof setImmediate, typeof global].join(' '));
} catch (e) {
console.log(e.message);
}
});

View file

@ -84,6 +84,14 @@ describe '<webview> tag', ->
webview.src = "file://#{fixtures}/pages/e.html"
document.body.appendChild webview
it 'preload script can still use "process" in required modules when nodeintegration is off', (done) ->
webview.addEventListener 'console-message', (e) ->
assert.equal e.message, 'object function object'
done()
webview.setAttribute 'preload', "#{fixtures}/module/preload-node-off.js"
webview.src = "file://#{fixtures}/api/blank.html"
document.body.appendChild webview
it 'receives ipc message in preload script', (done) ->
message = 'boom!'
listener = (e) ->