Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 6d51d579af47028306a003653150ade5d395f942
      
https://github.com/WebKit/WebKit/commit/6d51d579af47028306a003653150ade5d395f942
  Author: Ross Kirsling <[email protected]>
  Date:   2024-02-20 (Tue, 20 Feb 2024)

  Changed paths:
    A JSTests/stress/promise-try.js
    M Source/JavaScriptCore/builtins/PromiseConstructor.js
    M Source/JavaScriptCore/runtime/JSPromiseConstructor.cpp
    M Source/JavaScriptCore/runtime/OptionsList.h

  Log Message:
  -----------
  [JSC] Implement Promise.try
https://bugs.webkit.org/show_bug.cgi?id=269775

Reviewed by Justin Michaud.

This patch implements https://github.com/tc39/proposal-promise-try behind a 
runtime option;
the proposal is currently at Stage 2 but the spec is very simple and not 
expected to change.

Effectively, Promise.try(f) is a more convenient way to write `new 
Promise((resolve) => { resolve(f()); })` --
we don't care whether f is sync or async, but if is synchronous, we want it to 
be executed immediately.

This implementation includes 
https://github.com/tc39/proposal-promise-try/pull/16, which the champion 
expects to merge;
it simply extends the API to Promise.try(f, ...args) such that arguments can be 
forwarded to the callback.

* JSTests/stress/promise-try.js: Added.
* Source/JavaScriptCore/builtins/PromiseConstructor.js:
(try): Added.
* Source/JavaScriptCore/runtime/JSPromiseConstructor.cpp:
(JSC::JSPromiseConstructor::finishCreation):
* Source/JavaScriptCore/runtime/OptionsList.h:

Canonical link: https://commits.webkit.org/275081@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to