Object.getOwnPropertyDescriptor can return just about anything
allen at wirfs-brock.com
Wed Apr 30 14:06:41 PDT 2014
On May 1, 2014, at 2:50 AM, Jason Orendorff <jason.orendorff at gmail.com> wrote:
> As specified, proxies can do this:
> js> Object.isFrozen(proxy)
> js> Object.getOwnPropertyDescriptor(proxy).configurable
No, that is not the intent. However, Object.isFrozen depends upon the reliability of [[OwnPropertyKeys]] and one of its checked variants (and this is not yet in the spec. because Tom, Mark, and I just worked out the final details last week) is that [[OwnPropertyKeys]] must return a complete and accurate list of all non-configurable property names.
Also note that Object.isFrozen is specified to operates at the level of the MOP operations and property descriptor records, not at the Object.getOwnPropertyDescriptor/descriptor object level. It never looks at the object that is passed through [[Origin]].
It isn’t clear exactly what you intend by the above snippet (does proxy have a ‘getOwnPropertyDescriptorHandler’? did you really mean to use undefined as the property key?). In either case, if the object passes the criteria for isFrozen then then the con configurable attribute of the resulting descriptor (if the property exists) must be false and consistent with the target. Steps 11-21 of 9.9.5 (proxy [[GetOwnProperty]] are intended to guarantees that. Maybe there are bugs in those steps, I can review them in detail right now, but the design intent is a frozen object can never expose a ;configurable property.
> Of course the property is not really configurable. The extent of the
> issue is that Object.getOwnPropertyDescriptor is not a reliable
> reflection API.
It’s supposed to be for frozen objects, so if you see bugs in that regard I’m obvious interested.
More information about the es-discuss