From c50b5184933b764ecb5bef7641a9a9db8980f9db Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Fri, 17 Mar 2017 10:29:07 -0700 Subject: [PATCH] Check toString after loading remote properties --- lib/renderer/api/remote.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/renderer/api/remote.js b/lib/renderer/api/remote.js index 60a3478..5059dd6 100644 --- a/lib/renderer/api/remote.js +++ b/lib/renderer/api/remote.js @@ -175,11 +175,16 @@ const proxyFunctionProperties = function (remoteMemberFunction, metaId, name) { return true }, get: (target, property, receiver) => { - if (property === 'toString' && typeof target.toString === 'function') { - return target.toString.bind(target) - } if (!target.hasOwnProperty(property)) loadRemoteProperties() - return target[property] + const value = target[property] + + // Bind toString to target if it is a function to avoid + // Function.prototype.toString is not generic errors + if (property === 'toString' && typeof value === 'function') { + return value.bind(target) + } + + return value }, ownKeys: (target) => { loadRemoteProperties() -- 2.7.4