Add explicit test for IPC cycle detection

This commit is contained in:
Kevin Sawicki 2016-08-29 10:25:05 -07:00
parent 434e7cb5e9
commit 558ee08be9

View file

@ -362,6 +362,25 @@ describe('ipc module', function () {
}) })
ipcRenderer.send('message', array, foo, bar, child) ipcRenderer.send('message', array, foo, bar, child)
}) })
it('inserts null for cyclic references', function (done) {
const array = [5]
array.push(array)
const child = {hello: 'world'}
child.child = child
ipcRenderer.once('message', function (event, arrayValue, childValue) {
assert.equal(arrayValue[0], 5)
assert.equal(arrayValue[1], null)
assert.equal(childValue.hello, 'world')
assert.equal(childValue.child, null)
done()
})
ipcRenderer.send('message', array, child)
})
}) })
describe('ipc.sendSync', function () { describe('ipc.sendSync', function () {