Bug 232724 - Array.prototype.toLocaleString does not stringify undefined/null localization results
Summary: Array.prototype.toLocaleString does not stringify undefined/null localization...
Status: RESOLVED DUPLICATE of bug 232723
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-11-04 13:24 PDT by Richard Gibson
Modified: 2022-01-03 07:19 PST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Gibson 2021-11-04 13:24:51 PDT
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
Comment 1 Radar WebKit Bug Importer 2021-11-11 12:25:22 PST
<rdar://problem/85310544>
Comment 2 Yusuke Suzuki 2022-01-03 07:19:01 PST
Will do it in bug 232723 :D

*** This bug has been marked as a duplicate of bug 232723 ***