Remote object's members should reference itself

This commit is contained in:
Cheng Zhao 2016-04-01 15:26:30 +09:00
parent f36851fcff
commit 4ebb01f8c9

View file

@ -109,9 +109,16 @@ let setObjectMembers = function (object, metaId, members) {
return metaToValue(ret)
}
}
descriptor.writable = true
descriptor.get = function () {
remoteMemberFunction.ref = object // The member should reference its object.
return remoteMemberFunction
}
// Enable monkey-patch the method
descriptor.set = function (value) {
remoteMemberFunction = value
return value
}
descriptor.configurable = true
descriptor.value = remoteMemberFunction
} else if (member.type === 'get') {
descriptor.get = function () {
return metaToValue(ipcRenderer.sendSync('ATOM_BROWSER_MEMBER_GET', metaId, member.name))