Bug 232724
Summary: | Array.prototype.toLocaleString does not stringify undefined/null localization results | ||
---|---|---|---|
Product: | WebKit | Reporter: | Richard Gibson <richard.gibson> |
Component: | JavaScriptCore | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED DUPLICATE | ||
Severity: | Normal | CC: | webkit-bug-importer, ysuzuki |
Priority: | P2 | Keywords: | InRadar |
Version: | WebKit Nightly Build | ||
Hardware: | Unspecified | ||
OS: | Unspecified |
Richard Gibson
The algorithm at https://tc39.es/ecma402/#sup-array.prototype.tolocalestring requires looking up a "toLocaleString" property on each non-undefined non-null element of the receiver array, invoking it as a method, and (absent an exception) passing the result through ToString. However, JSC appears to bypass ToString for undefined or null output from the toLocaleString method.
The following expression should evaluate to "undefined", but instead evaluates to "":
[{toLocaleString(){}}].toLocaleString()
The following expression should evaluate to "null", but instead evaluates to "":
[{toLocaleString(){return null}}].toLocaleString()
Also reported to test262 for coverage: https://github.com/tc39/test262/issues/3298
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/85310544>
Yusuke Suzuki
Will do it in bug 232723 :D
*** This bug has been marked as a duplicate of bug 232723 ***