Skip to content

Update test262 suite and fix promise combinator non-thenable handling - #2500

Merged
lahma merged 1 commit into
sebastienros:mainfrom
lahma:test262-update-2026-06-07
Jun 7, 2026
Merged

lahma merged 1 commit into
sebastienros:mainfrom
lahma:test262-update-2026-06-07

Conversation

@lahma

@lahma lahma commented Jun 7, 2026

Copy link
Copy Markdown
Collaborator

Updates the test262 suite to commit 05bb0329. The only new upstream commit (tc39/test262#5041) adds failure-case and edge-case tests for the await-dictionary proposal (Promise.allKeyed / Promise.allSettledKeyed).

Bug exposed by the new tests

The new ctx-ctor-constructed.js tests failed: when a custom constructor''s resolve method returns a non-thenable value, PerformPromiseAllKeyed invoked "then" via Engine.Invoke, which throws TypeErrorException. That exception type bypasses the catch (JavaScriptException) reject path in Promise.allKeyed / Promise.allSettledKeyed, so the combinator threw synchronously instead of rejecting the result capability promise as required by IfAbruptRejectPromise.

Promise.race had the same latent bug (no test262 coverage for it today, fixed here as well since it is the identical defect).

Fix

Perform the spec Invoke(nextPromise, "then", ...) inline — GetV + IsCallable check + Call — and throw a realm-aware TypeError with the V8-style kCalledNonCallable message (undefined is not a function), matching how Promise.all, allSettled and any already handle the non-thenable case in this file. Using GetV keeps the correct primitive prototype lookup semantics that Engine.Invoke had.

Test results

Suite Result
test262 (full) 99,260 passed, 0 failed, 133 skipped (configured exclusions)
Promise test262 subset 1,400 passed, 0 failed
Jint.Tests (net10.0) 3,067 passed, 0 failed
Jint.Tests (net472) 3,005 passed, 0 failed

🤖 Generated with Claude Code

Updates the test262 suite to commit 05bb032907160d66c212589d345fa0e335e2738c,
which adds new await-dictionary edge case tests for Promise.allKeyed and
Promise.allSettledKeyed.

The new ctx-ctor-constructed.js tests exposed a bug: when a custom
constructor's resolve method returns a non-thenable value, the combinators
invoked "then" via Engine.Invoke, which throws TypeErrorException. That
exception type bypasses the catch (JavaScriptException) reject path, so the
combinator threw synchronously instead of rejecting the result capability
promise as required by IfAbruptRejectPromise. Promise.race had the same
latent bug.

The fix performs the spec Invoke inline (GetV + IsCallable check + Call) and
throws a realm-aware TypeError using the V8-style message, matching how
Promise.all, allSettled and any already handle the non-thenable case.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@lahma
lahma enabled auto-merge (squash) June 7, 2026 10:25
@lahma
lahma merged commit 9e55ba6 into sebastienros:main Jun 7, 2026
4 checks passed
@lahma
lahma deleted the test262-update-2026-06-07 branch June 7, 2026 12:15
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