Merge pull request #7980 from electron/guard-against-missing-members

Guard against missing members in setObjectMembers
This commit is contained in:
Kevin Sawicki 2016-11-16 07:46:42 -08:00 committed by GitHub
commit 63a138b6de

View file

@ -95,6 +95,8 @@ const wrapArgs = function (args, visited) {
// The |ref| will be kept referenced by |members|.
// This matches |getObjectMemebers| in rpc-server.
const setObjectMembers = function (ref, object, metaId, members) {
if (!Array.isArray(members)) return
for (let member of members) {
if (object.hasOwnProperty(member.name)) continue
@ -161,9 +163,7 @@ const proxyFunctionProperties = function (remoteMemberFunction, metaId, name) {
if (loaded) return
loaded = true
const meta = ipcRenderer.sendSync('ELECTRON_BROWSER_MEMBER_GET', metaId, name)
if (Array.isArray(meta.members)) {
setObjectMembers(remoteMemberFunction, remoteMemberFunction, meta.id, meta.members)
}
setObjectMembers(remoteMemberFunction, remoteMemberFunction, meta.id, meta.members)
}
return new Proxy(remoteMemberFunction, {