A DOM use case that can't be emulated with direct proxies

Jason Orendorff jason.orendorff at gmail.com
Thu Dec 13 11:47:49 PST 2012


On Wed, Dec 12, 2012 at 3:44 PM, David Bruant <bruant.d at gmail.com> wrote:

>  Le 12/12/2012 22:30, Kevin Reid a écrit :
>
>  The JS runtime won't know that the proxy has anything to do with the
> actual Window instance. The Proxy's formal target will be just {};
>
> This target, even if dummy, is the one that will be used for invariants
> checks. You can't get away from this by design. This is one of the most
> important part of the direct proxies design.
> Even if you switch of fake target, the engine will still perform checks on
> the dummy internal [[Target]].
>
> I feel we're cycling in what we say and I feel I can't find the right
> words to explain my point. One idea would be for you to implement a
> target-switching proxy based on direct proxies (Firefox has them natively
> or you can use Tom's shim [1]). I'm confident you'll understand my point
> through this exercise.
>

David: https://gist.github.com/4279162

I think this is what Kevin has in mind. Note in particular that the target
of the Proxy is just a dummy object, and the handler ignores it entirely.
The proxy uses it for invariant checks, but the intent is that those would
always pass.

-j
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20121213/e6cf814e/attachment.html>


More information about the es-discuss mailing list