Implementing membranes using proxies, and [[GetInheritance]]

Boris Zbarsky bzbarsky at MIT.EDU
Wed Sep 11 07:52:14 PDT 2013


On 9/11/13 5:14 AM, David Bruant wrote:
> Le 11/09/2013 06:10, Boris Zbarsky a écrit :
>> I was looking at implementing a membrane using ES6 proxies
> May I ask why you've been working on that?

It came up in the context of a discussion about how to handle __proto__ 
sets on WebIDL objects in Gecko that are implemented by proxy-like 
objects due to having named or indexed getters.  That led to 
[[Get/SetInheritance]], which led me to try to understand this part of 
the spec.  It seemed like [[GetInheritance]] was on the one hand 
providing a lot of room to hang yourself (e.g. traversing the proto 
chain is no longer idempotent, nor guaranteed to terminate!) while not 
allowing the basic membrane case to work in the obvious way...

> One design goal of proxies was getting closer to self-hostability of the
> DOM/browser APIs

Yeah, I was basically thinking about how I'd do Gecko's cross-global 
wrappers with ES proxies (not that that's a reasonable thing to do, 
since it requires APIs that simply can't be exposed to script).

> so if you're working on something that validates (or
> not) the proxy design and its practicality for this use case, it would
> be valuable feedback.

All that WebIDL requires is the ability to write a custom implementation 
of [[GetOwnProperty]], [[Delete]], and [[DefineProperty]].  What I 
haven't checked is whether the WebIDL algorithms for those can be 
implemented within the constraints that are imposed on proxy handlers at 
the moment.

The question of how WindowProxy works is still open; it's not defined in 
terms of the MOP... yet.

-Boris



More information about the es-discuss mailing list