Object.getOwnPropertyDescriptor can return just about anything

David Bruant bruant.d at gmail.com
Fri May 9 00:57:37 PDT 2014

Le 09/05/2014 08:50, Tom Van Cutsem a écrit :
> Rick,
> It's true that allowing user-invented custom attributes will not break 
> any important existing invariants (except perhaps that all existing 
> descriptors can be assumed not to have any own properties besides the 
> standard attributes. Existing code may depend on that, although it 
> feels highly unlikely).
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?


More information about the es-discuss mailing list