-
Notifications
You must be signed in to change notification settings - Fork 472
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Object.defineProperties must not throw when provided undefined in place of a descriptor #652
Comments
It properly throws a TypeError when you call ToPropertyDescriptor passing an undefined value:
var o = {};
var properties = { prop: undefined };
Object.defineProperties(o, properties);
// props = properties
// keys = [ 'prop' ]
// keys => each( nextKey ):
// nextKey = 'prop'
// propDesc = props.[[GetOwnProperty]]('prop')
// propDesc = {value: undefined, writable: true, enumerable: true, configurable: true}
// descObj = Get(props, 'prop')
// descObj = undefined
// desc = ToPropertyDescriptor(undefined)
// => descObj((undefined)) is not Object, throw a TypeError exception. |
There was some confusion of my part: In step 5b of DefinePropertyDescriptors, the condition is |
It is confusing as it catches the prop descriptors to find the enumerables Btw, On Friday, May 27, 2016, Claude Pache notifications@github.com wrote:
|
Or no, I'm in a train and will revise my last comment in a better moment. On Friday, May 27, 2016, Leo Balter leonardo.balter@gmail.com wrote:
|
Apparently, a change between ES5 and ES6 not reflected in the test suite, (neither in the few implementations I have checked, BTW).test/built-ins/Object/defineProperties/15.2.3.7-5-b-1.js contains:
(I have not checked the numerous other tests about the same step.)
However, according to ecma262#sec-objectdefineproperties Step 5.b, undefined values must not throw, but be ignored.The text was updated successfully, but these errors were encountered: