зеркало из https://github.com/electron/electron.git
Add spec for Buffer global
This commit is contained in:
Родитель
80dad58a59
Коммит
70010fdb8e
|
@ -801,8 +801,9 @@ describe('BrowserWindow module', function () {
|
|||
describe('"node-integration" option', function () {
|
||||
it('disables node integration when specified to false', function (done) {
|
||||
var preload = path.join(fixtures, 'module', 'send-later.js')
|
||||
ipcMain.once('answer', function (event, test) {
|
||||
assert.equal(test, 'undefined')
|
||||
ipcMain.once('answer', function (event, typeofProcess, typeofBuffer) {
|
||||
assert.equal(typeofProcess, 'undefined')
|
||||
assert.equal(typeofBuffer, 'undefined')
|
||||
done()
|
||||
})
|
||||
w.destroy()
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
setImmediate(function () {
|
||||
try {
|
||||
console.log([typeof process, typeof setImmediate, typeof global].join(' '))
|
||||
console.log([typeof process, typeof setImmediate, typeof global, typeof Buffer].join(' '))
|
||||
} catch (e) {
|
||||
console.log(e.message)
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
console.log([typeof require, typeof module, typeof process].join(' '))
|
||||
console.log([typeof require, typeof module, typeof process, typeof Buffer].join(' '))
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
var ipcRenderer = require('electron').ipcRenderer
|
||||
window.onload = function () {
|
||||
ipcRenderer.send('answer', typeof window.process)
|
||||
ipcRenderer.send('answer', typeof window.process, typeof window.Buffer)
|
||||
}
|
||||
|
|
|
@ -171,7 +171,7 @@ describe('<webview> tag', function () {
|
|||
describe('preload attribute', function () {
|
||||
it('loads the script before other scripts in window', function (done) {
|
||||
var listener = function (e) {
|
||||
assert.equal(e.message, 'function object object')
|
||||
assert.equal(e.message, 'function object object function')
|
||||
webview.removeEventListener('console-message', listener)
|
||||
done()
|
||||
}
|
||||
|
@ -181,9 +181,9 @@ describe('<webview> tag', function () {
|
|||
document.body.appendChild(webview)
|
||||
})
|
||||
|
||||
it('preload script can still use "process" in required modules when nodeintegration is off', function (done) {
|
||||
it('preload script can still use "process" and "Buffer" in required modules when nodeintegration is off', function (done) {
|
||||
webview.addEventListener('console-message', function (e) {
|
||||
assert.equal(e.message, 'object undefined object')
|
||||
assert.equal(e.message, 'object undefined object function')
|
||||
done()
|
||||
})
|
||||
webview.setAttribute('preload', fixtures + '/module/preload-node-off.js')
|
||||
|
@ -212,7 +212,7 @@ describe('<webview> tag', function () {
|
|||
|
||||
it('works without script tag in page', function (done) {
|
||||
var listener = function (e) {
|
||||
assert.equal(e.message, 'function object object')
|
||||
assert.equal(e.message, 'function object object function')
|
||||
webview.removeEventListener('console-message', listener)
|
||||
done()
|
||||
}
|
||||
|
@ -224,7 +224,7 @@ describe('<webview> tag', function () {
|
|||
|
||||
it('resolves relative URLs', function (done) {
|
||||
var listener = function (e) {
|
||||
assert.equal(e.message, 'function object object')
|
||||
assert.equal(e.message, 'function object object function')
|
||||
webview.removeEventListener('console-message', listener)
|
||||
done()
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче