From 1a1cf57097c37ef91c9663185008cbf4b7b4b09c Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 14 Jan 2015 19:33:24 -0800 Subject: [PATCH] Unpack the arguments in ipc message --- atom/browser/api/lib/web-contents.coffee | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/atom/browser/api/lib/web-contents.coffee b/atom/browser/api/lib/web-contents.coffee index 5ed80a54ab0..5217a7b386d 100644 --- a/atom/browser/api/lib/web-contents.coffee +++ b/atom/browser/api/lib/web-contents.coffee @@ -48,10 +48,12 @@ module.exports.wrap = (webContents) -> process.emit 'ATOM_BROWSER_RELEASE_RENDER_VIEW', "#{processId}-#{routingId}" # Dispatch IPC messages to the ipc module. - webContents.on 'ipc-message', (event, channel, args...) -> + webContents.on 'ipc-message', (event, packed) -> + [channel, args...] = packed Object.defineProperty event, 'sender', value: webContents ipc.emit channel, event, args... - webContents.on 'ipc-message-sync', (event, channel, args...) -> + webContents.on 'ipc-message-sync', (event, packed) -> + [channel, args...] = packed Object.defineProperty event, 'returnValue', set: (value) -> event.sendReply JSON.stringify(value) Object.defineProperty event, 'sender', value: webContents ipc.emit channel, event, args...