Wrap remote value being set as an arg

This commit is contained in:
Kevin Sawicki 2017-04-03 14:18:04 -07:00
parent e5f70f90a4
commit 7065123266
2 changed files with 5 additions and 3 deletions

View file

@ -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}`)

View file

@ -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) {