__proto__ and JSON
Mark S. Miller
erights at google.com
Wed May 30 10:18:42 PDT 2012
On Wed, May 30, 2012 at 7:12 AM, Felix Böhm <esdiscuss at feedic.com> wrote:
> 2012/5/30 Brendan Eich <brendan at mozilla.com>
>> Felix Böhm wrote:
>>> Okay, fair point. But JSON.parse should do what it's name says: Parse
>>> JSON. Ignoring keys is not an option.
>> JSON.parse must not treat __proto__ specially, per ES5. What's the
>> problem you see?
> As written before, V8 ignores keys named __proto__ in JSON.parse (I
> haven't tested other engines yet). I was concerned that this behavior would
> become the default.
These are filed and accepted bugs in v8:
and tested by test262:
>> Having __proto__ as a setter would make much more sense for me, too. No
>>> magic involved, just some functionality I don't need to care about.
>> Please see the thread on "Re: Subclassing built-in constructors", also
>> the meeting notes followups from me. __proto__ has a hidden setter, it
>> masquerades as a data property to avoid leaking a set-[[Prototype]]
>> capability that would require extra checking and could (based on long and
>> hard experience) lead to mischief.
>> The de-facto and soon to be de-jure Object.prototype.__proto__ standard
>> has no bearing on ES5's JSON.parse, which continues unchanged per the JSON
>> RFC (I trust -- tell me if you see a bug).
> es-discuss mailing list
> es-discuss at mozilla.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss