Open
Description
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: