mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
Add failing spec for duplicate references over IPC
This commit is contained in:
@@ -325,6 +325,22 @@ describe('ipc module', function () {
|
||||
})
|
||||
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 () {
|
||||
|
||||
@@ -35,8 +35,8 @@ process.stdout
|
||||
// Access console to reproduce #3482.
|
||||
console
|
||||
|
||||
ipcMain.on('message', function (event, arg) {
|
||||
event.sender.send('message', arg)
|
||||
ipcMain.on('message', function (event, ...args) {
|
||||
event.sender.send('message', ...args)
|
||||
})
|
||||
|
||||
// Write output to file if OUTPUT_TO_FILE is defined.
|
||||
|
||||
Reference in New Issue
Block a user