From: Kevin Sawicki Date: Mon, 3 Apr 2017 21:18:04 +0000 (-0700) Subject: Wrap remote value being set as an arg X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7065123266ec17d709348185c699d07a1f5555f1;p=platform%2Fframework%2Fweb%2Fcrosswalk-tizen.git Wrap remote value being set as an arg --- diff --git a/lib/browser/rpc-server.js b/lib/browser/rpc-server.js index 13d6f88..3da0590 100644 --- a/lib/browser/rpc-server.js +++ b/lib/browser/rpc-server.js @@ -360,9 +360,10 @@ ipcMain.on('ELECTRON_BROWSER_MEMBER_CALL', function (event, id, method, args) { } }) -ipcMain.on('ELECTRON_BROWSER_MEMBER_SET', function (event, id, name, value) { +ipcMain.on('ELECTRON_BROWSER_MEMBER_SET', function (event, id, name, args) { try { - let obj = objectsRegistry.get(id) + const [value] = unwrapArgs(event.sender, args) + const obj = objectsRegistry.get(id) if (obj == null) { throwRPCError(`Cannot set property '${name}' on missing remote object ${id}`) diff --git a/lib/renderer/api/remote.js b/lib/renderer/api/remote.js index f65d617..5e79013 100644 --- a/lib/renderer/api/remote.js +++ b/lib/renderer/api/remote.js @@ -139,7 +139,8 @@ const setObjectMembers = function (ref, object, metaId, members) { // Only set setter when it is writable. if (member.writable) { descriptor.set = function (value) { - const meta = ipcRenderer.sendSync('ELECTRON_BROWSER_MEMBER_SET', metaId, member.name, value) + const args = wrapArgs([value]) + const meta = ipcRenderer.sendSync('ELECTRON_BROWSER_MEMBER_SET', metaId, member.name, args) // Meta will be non-null when a setter error occurred so parse it // to a value so it gets re-thrown. if (meta != null) {