RESOLVED INVALID 161673
[INTL] Intl constructors do not throw when called with a previously initialized intl object
https://bugs.webkit.org/show_bug.cgi?id=161673
Summary [INTL] Intl constructors do not throw when called with a previously initializ...
Andy VanWagoner
Reported 2016-09-06 20:46:00 PDT
Part of the kangax compat table tests[1] properly throwing an error when you call the Intl constructors with an object already initialized as an intl object. This is according to spec.[2][3][4] Firefox, Chrome, and Edge properly throw in these tests. These should all throw: Intl.Collator.call(Intl.Collator()) Intl.DateTimeFormat.call(Intl.DateTimeFormat()) Intl.NumberFormat.call(Intl.NumberFormat()) [1] http://kangax.github.io/compat-table/esintl/ [2] http://ecma-international.org/ecma-402/3.0/index.html#sec-initializecollator [3] http://ecma-international.org/ecma-402/3.0/index.html#sec-initializenumberformat [4] http://ecma-international.org/ecma-402/3.0/index.html#sec-initializedatetimeformat
Attachments
Andy VanWagoner
Comment 1 2016-09-07 09:20:48 PDT
I may be reading the spec[1] wrong, but it looks like v2 and v3 of the spec say that when called without the `new` keyword, the constructors always return a new object. Initializing a previous object is legacy v1 only. That would mean JSC is correct and the other implementations don't give the v2&3 behavior. [1] http://ecma-international.org/ecma-402/3.0/index.html#sec-the-intl-collator-constructor
Andy VanWagoner
Comment 2 2016-09-07 09:46:40 PDT
The test262 suite[1] seems to agree that the current behavior is the correct one. I'm moving the issue to kangax's test[2]. [1] https://github.com/tc39/test262/blob/master/test/intl402/Collator/10.1.1_1.js [2] https://github.com/kangax/compat-table/issues/900
Note You need to log in before you can comment on or make changes to this bug.