The Structured Clone Wars

Tom Van Cutsem tomvc.be at gmail.com
Fri Jul 15 01:26:05 PDT 2011


2011/7/15 Jason Orendorff <jason.orendorff at gmail.com>

> Back to Mark S. Miller:
> > And finally there's the issue raised by David on the es-discuss thread:
> What
> > should the structured clone algorithm do when encountering a proxy? The
> > algorithm as coded below will successfully "clone" proxies, for some
> meaning
> > of clone. Is that the clone behavior we wish for proxies?
>
> The structured cloning algorithm should be redefined in terms of the
> ES object protocol. This seems necessary anyway, for precision.
>
> The appropriate behavior regarding proxies would fall out of that;
> proxies would not have to be specifically mentioned in the algorithm's
> spec.
>

+1. This also matches with the behavior of JSON.stringify(aProxy):
serializing a proxy as data should simply query the object's own properties
by calling the appropriate traps (in the case of JSON, this includes
intercepting the call to 'toJSON').

(Every algorithm that mentions proxies, or really any other object
> type, by name is one broken piece of a Proxy.isProxy implementation.)
>
> Cheers,
> -j
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110715/2a6b2e29/attachment.html>


More information about the es-discuss mailing list