Object.getOwnPropertyDescriptor can return just about anything

Andrea Giammarchi andrea.giammarchi at gmail.com
Tue Apr 29 16:22:48 PDT 2014


I think Eric Faust is right over there when he says: "It is easily fixed if
we do the conversion to PropSpec in the proxy api"

my 2 cents


On Tue, Apr 29, 2014 at 3:43 PM, Jason Orendorff
<jason.orendorff at gmail.com>wrote:

> The [[Origin]] field of Property Descriptor Records is not yet
> implemented in Firefox. Eric Faust is looking at implementing it.[1]
> We noticed two interesting cases:
>
> 1. Suppose handler.getOwnPropertyDescriptor returns ({value: 0}). Then
> 9.5.5 Proxy.[[GetOwnProperty]] calls 6.2.4.6
> CompletePropertyDescriptor, and all the fields of the Property
> Descriptor Record are populated. But the object itself is not
> populated. This means Object.getOwnPropertyDescriptor will return an
> object that is missing most of the fields the caller wants to know
> about. This seems strange.
>
> 2. The object returned by the handler can have getters. It can answer
> ToPropertyDescriptor's queries one way, and then say something else
> afterwards, making it look like language invariants have been broken.
>
> Come to think of it, [[GetOwnProperty]] is a weird API. It computes
> two results: a set of Property Descriptor fields, and an [[Origin]]
> object. The ES language itself relies exclusively on the former.
> Scripts are only allowed to see the latter. That seems really weird to
> me.
>
> What is an example of a concrete use case for this [[Origin]] feature?
> Is it to avoid allocating a new object here?
>
> -j
>
>     [1] https://bugzilla.mozilla.org/show_bug.cgi?id=999156
> _______________________________________________
> 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/20140429/040c2db5/attachment.html>


More information about the es-discuss mailing list