diff --git a/spec/api-ipc-spec.js b/spec/api-ipc-spec.js index ff91e70b2136..1af3ce6634ea 100644 --- a/spec/api-ipc-spec.js +++ b/spec/api-ipc-spec.js @@ -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 () { diff --git a/spec/static/main.js b/spec/static/main.js index cefb79f6c2ab..967cd02b7310 100644 --- a/spec/static/main.js +++ b/spec/static/main.js @@ -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.