Add failing spec for Buffer from preload required module

This commit is contained in:
Kevin Sawicki 2017-02-23 11:26:37 -08:00
parent b936221b63
commit e6fec57bd8
3 changed files with 19 additions and 1 deletions

View file

@ -0,0 +1,3 @@
setImmediate(function () {
require('./preload-required-module')
})

View file

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

View file

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