archives

« Bugzilla Issues Index

#3399 — 12.1.1.1 ToDateTimeOptions: Change Throw parameter to true


12.1.1.1 ToDateTimeOptions, steps 7.a.i and 8.a.i:

The Throw parameter for the [[DefineOwnProperty]] calls should be changed from `false` to `true`, because

1) it's more in line with other uses in ES5/6
2) implementations (IE11, V8, SpiderMonkey) already throw.


Test case:
---
var options = {get second() {
Object.defineProperty(this, "year", {value: "2-digit"});
}};
new Intl.DateTimeFormat("de", options).format(new Date);
---

Expected (ECMA-402 1st, 2nd draft Feb 28 2013): No exception thrown
Actual (implementations): TypeError is thrown (e.g. V8 reports "TypeError: Cannot redefine property: year")


Forgot to mention:
In ES6 terms this means using CreateDataPropertyOrThrow instead of CreateDataProperty.


Fixed in rev7