Calling toString on function proxy throws TypeError exception

Claude Pache claude.pache at gmail.com
Tue Oct 27 17:05:07 UTC 2015


> Le 27 oct. 2015 à 15:52, Mark S. Miller <erights at google.com> a écrit :
> 
> Notice that whatever we decide on the issue, functionProxy.toString() will work regardless, since you'd be getting the toString method itself through the membrane. functionProxy.toString will be a function proxy for the target.toString method.

... at the condition that the proxy handler explicitly traps the getting of the toString method. It is certainly the case for impermeable membranes, but not for all proxies. Concretely, `new Proxy(function() {}, {}).toString()` does throw in ES2015.

—Claude


> The invocation on the toString proxy with functionProxy as this will be translated by the membrane back into an invocation of target.toString with target as this.
> 
> The issue we're debating is only relevant on an edge case -- when explicitly invoking F.p.toString.call(functionProxy).
> 
> 
> -- 
>     Cheers,
>     --MarkM



More information about the es-discuss mailing list