Add failing spec for duplicate references over IPC

This commit is contained in:
Kevin Sawicki 2016-08-25 09:10:37 -07:00
parent 97a004a357
commit 10d39f673a
2 changed files with 18 additions and 2 deletions

View file

@ -325,6 +325,22 @@ describe('ipc module', function () {
}) })
ipcRenderer.send('message', document.location) ipcRenderer.send('message', document.location)
}) })
it('can send objects that both reference the same object', function (done) {
const child = {hello: 'world'}
const foo = {name: 'foo', child: child}
const bar = {name: 'bar', child: child}
const array = [foo, bar]
ipcRenderer.once('message', function (event, arrayValue, fooValue, barValue, childValue) {
assert.deepEqual(arrayValue, array)
assert.deepEqual(fooValue, foo)
assert.deepEqual(barValue, bar)
assert.deepEqual(childValue, child)
done()
})
ipcRenderer.send('message', array, foo, bar, child)
})
}) })
describe('ipc.sendSync', function () { describe('ipc.sendSync', function () {

View file

@ -35,8 +35,8 @@ process.stdout
// Access console to reproduce #3482. // Access console to reproduce #3482.
console console
ipcMain.on('message', function (event, arg) { ipcMain.on('message', function (event, ...args) {
event.sender.send('message', arg) event.sender.send('message', ...args)
}) })
// Write output to file if OUTPUT_TO_FILE is defined. // Write output to file if OUTPUT_TO_FILE is defined.