Proxying built-ins (Was: [[Invoke]] and implicit method calls)

Boris Zbarsky bzbarsky at MIT.EDU
Wed Sep 25 07:13:22 PDT 2013


On 9/25/13 5:18 AM, Tom Van Cutsem wrote:
> The auto-unwrapping doesn't break membranes, because membranes never
> expose direct references to built-in functions (they only expose wrapper
> functions, which can still do whatever interposition they want before
> calling the actual built-in).

I'd like to clarify this part a bit...  What happens when I take a 
built-in from one realm and .call() it on a proxy which is implementing 
a cross-realm membrane?

In this situation, I will claim the right behavior is to throw if the 
cross-realm access is disallowed and to unwrap the proxy otherwise. 
This is the behavior SpiderMonkey implements or its cross-realm proxies, 
in fact.  But at the moment this is implemented via having a special 
brand on cross-realm proxies that indicates they're cross-realm proxies 
and giving cross-realm proxies's handler an extra "is it safe to unwrap 
your proxies?" hook.

All of which is to say, maybe such a hook is needed in general?

-Boris


More information about the es-discuss mailing list