Object.getOwnPropertyDescriptor can return just about anything

Tom Van Cutsem tomvc.be at gmail.com
Fri May 9 05:23:49 PDT 2014

2014-05-09 9:57 GMT+02:00 David Bruant <bruant.d at gmail.com>:

> Just to try to assess the unlikelihood and understand the cases where a
> ES5 code expectations aren't met:
> The only case where ES6 and ES5 may diverge is for Object.getOwnPropertyDescriptor
> where a Proxy may return something that cannot be expected from any ES5
> object.
> The after-trap completes the property descriptor (and when completing
> picks specifically only data or accessor property), so code that expects a
> complete property descriptor cannot be broken.
> However, a divergence may only occur if, for instance, the code loops over
> the property descriptor properties or expects exactly 4 properties.
> Is that correct or am I missing cases?

Another possibility would be that existing client code itself extends
property descriptors with new attributes (since descriptors returned by
gOPD are always extensible), and can then get confused when proxies
pre-populate these descriptors with their own custom attributes. But again,
this is highly unlikely. I think allowing proxies to accept/return custom
attributes remains feasible.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140509/fe68eb0c/attachment.html>

More information about the es-discuss mailing list