"compatible descriptors" and how they are checked
Tom Van Cutsem
tomvc.be at gmail.com
Wed Sep 19 04:33:03 PDT 2012
I think you caught a spec bug, because your example should indeed throw,
yet it currently doesn't (neither in my harmony-reflect shim nor in Firefox
The code doesn't throw because the relevant checks for
getOwnPropertyDescriptor are currently:
1) is the returned descriptor d "compatible" in the sense
that Object.defineProperty(target,name,d) wouldn't throw a TypeError. And
indeed, it is valid to redefine a configurable into a non-configurable
descriptor, so this check passes.
2) if the returned descriptor is non-configurable, check if the property
does exist on the target. Since the property exists, this check passes as
Check no. 2 should be strengthened to: if the returned descriptor is
non-configurable, check if the property does exist *as a non-configurable
property* on the target. Just checking for presence/absence is not strong
enough, as your example demonstrates.
Other than that: yes, in order to perform the check, the proxy will call
[[GetOwnProperty]] on the target, which is observable if the target is
itself a proxy, but that is already specified in the draft Proxy spec.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss