From: Cheng Zhao Date: Thu, 15 Jan 2015 03:33:24 +0000 (-0800) Subject: Unpack the arguments in ipc message X-Git-Tag: v0.20.7~13^2~3 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=1a1cf57097c37ef91c9663185008cbf4b7b4b09c;p=electron.git Unpack the arguments in ipc message --- diff --git a/atom/browser/api/lib/web-contents.coffee b/atom/browser/api/lib/web-contents.coffee index 5ed80a54..5217a7b3 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...