Skip to content

Add return abrupt from LengthOfArrayLike in toLocaleString - #5109

Open
Koreangung15 wants to merge 2 commits into
tc39:mainfrom
Koreangung15:localestring
Open

Add return abrupt from LengthOfArrayLike in toLocaleString#5109
Koreangung15 wants to merge 2 commits into
tc39:mainfrom
Koreangung15:localestring

Conversation

@Koreangung15

Copy link
Copy Markdown

This PR adds coverage for cases where LengthOfArrayLike, called in step 2 of Array.prototype.toLocaleString, returns an abrupt completion originating from Get or ToLength.

Array.prototype.toLocaleString converts its this value to an object and obtains that object's length by calling LengthOfArrayLike. Because the method is generic, a caller may supply an arbitrary array-like object as the this value, so an exception must be propagated in both of the following cases:

  • reading the "length" property invokes a getter that throws
  • coercing the retrieved length value invokes a "valueOf" method that throws

The equivalent case is covered for other methods that reach LengthOfArrayLike in the same way: Array.prototype.fill in test/built-ins/Array/prototype/fill/return-abrupt-from-this-length.js. However, it seems that current test cases in Array.prototype.toLocaleString are not checking whether abrupt completion of LengthOfArrayLike function is correctly propagated.

@Koreangung15
Koreangung15 requested a review from a team as a code owner August 18, 2026 05:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant