add tests for proposed faster-promise-try change - #5072
Merged
Merged
Conversation
gibson042
approved these changes
Jul 20, 2026
bakkot
marked this pull request as ready for review
July 20, 2026 20:30
bakkot
enabled auto-merge (squash)
August 10, 2026 16:13
webkit-commit-queue
pushed a commit
to Constellation/WebKit
that referenced
this pull request
Aug 17, 2026
https://bugs.webkit.org/show_bug.cgi?id=321890 rdar://185064567 Reviewed by Sosuke Suzuki. Test262 is updated[1] to include the latest spec change proposal for Promise.try[2], which uses PromiseResolve instead of a promise created by NewPromiseCapability. This simplifies our Promise.try implementation since we can just use @promiseResolve and @promisereject helpers instead. Also this removes the reference to @newPromiseCapability in JSC code. So we drop PromiseOperations.js and its JS builtins, and replace @newPromiseCapability with C++ version for remaining WebCore users. WebCore users can be replaced by using normal Promise + first-resolving handler. This is fixed in a subsequent change. [1]: tc39/test262#5072 [2]: tc39/ecma262#3883 * JSTests/test262/expectations.yaml: * Source/JavaScriptCore/CMakeLists.txt: * Source/JavaScriptCore/DerivedSources-input.xcfilelist: * Source/JavaScriptCore/DerivedSources.make: * Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj: * Source/JavaScriptCore/builtins/BuiltinNames.h: * Source/JavaScriptCore/builtins/PromiseConstructor.js: (try): * Source/JavaScriptCore/builtins/PromiseOperations.js: Removed. * Source/JavaScriptCore/bytecode/LinkTimeConstant.h: * Source/JavaScriptCore/runtime/JSGlobalObject.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): (JSC::JSGlobalObject::init): Canonical link: https://commits.webkit.org/319276@main
This was referenced Sep 1, 2026
ljharb
added a commit
to es-shims/Promise.try
that referenced
this pull request
Sep 9, 2026
tc39/ecma262#3883 changed `Promise.try` to end with `Return ? PromiseResolve(ctor, ! status)`, instead of creating a capability up front and resolving through it. A promise returned from the callback is now passed through rather than wrapped, and the capability is only created on the abrupt-completion path. test262 pins this in `built-ins/Promise/try/avoids-wrap.js` and `avoids-wrap-for-subclass.js` (tc39/test262#5072). No engine has shipped the change yet, so `getPolyfill` probes for the older wrapping behavior and falls back to the implementation.
ljharb
added a commit
to es-shims/Promise.try
that referenced
this pull request
Sep 9, 2026
tc39/ecma262#3883 changed `Promise.try` to end with `Return ? PromiseResolve(ctor, ! status)`, instead of creating a capability up front and resolving through it. A promise returned from the callback is now passed through rather than wrapped, and the capability is only created on the abrupt-completion path. test262 pins this in `built-ins/Promise/try/avoids-wrap.js` and `avoids-wrap-for-subclass.js` (tc39/test262#5072). No engine has shipped the change yet, so `getPolyfill` probes for the older wrapping behavior and falls back to the implementation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tests for tc39/ecma262#3883.
Also includes a test that
Subclass.tryuses the subclass to wrap the rejection. The linked PR doesn't change that but it's untested currently. I can split it into its own PR if you'd like.None of the existing tests are affected by that PR.