Skip to content
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

Missing tests for ECMA-402 Array.prototype.toLocaleString #3298

Open
gibson042 opened this issue Nov 4, 2021 · 0 comments
Open

Missing tests for ECMA-402 Array.prototype.toLocaleString #3298

gibson042 opened this issue Nov 4, 2021 · 0 comments
Labels

Comments

@gibson042
Copy link
Contributor

gibson042 commented Nov 4, 2021

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, behavior when that lookup does not return a method or when the method call returns undefined or null appears to not be covered by test262.

The following statement list should throw an exception:

delete Object.prototype.toLocaleString;
[{}].toLocaleString();

The following expression should evaluate to "undefined":

[{toLocaleString(){}}].toLocaleString()

The following expression should evaluate to "null":

[{toLocaleString(){return null}}].toLocaleString()

Every engine except JavaScriptCore seems to get this right, and bugs have now been reported there:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants