Object.getOwnPropertyDescriptor can return just about anything
Jason Orendorff
jason.orendorff at gmail.com
Wed Apr 30 09:50:34 PDT 2014
On Tue, Apr 29, 2014 at 8:08 PM, Mark S. Miller <erights at google.com> wrote:
>> There aren’t any internal invariant sensitivities that I could find. Once
>> such a non-standard descriptor is never directly used by any of the ordinary
>> object MOP operations
>
> I'm surprised and alarmed by this, and it seems wrong. It is also not what I
> think I remember. What about, for example, the invariant that an object
> cannot both claim that a property is non-configurable but then later change
> its alleged configuration?
As specified, proxies can do this:
js> Object.isFrozen(proxy)
true
js> Object.getOwnPropertyDescriptor(proxy).configurable
true
Of course the property is not really configurable. The extent of the
issue is that Object.getOwnPropertyDescriptor is not a reliable
reflection API.
-j
More information about the es-discuss
mailing list