[webkit-changes] [WebKit/WebKit] f4cbe7: [JSC][GLib] Provide deferred promise creation api

Théo MAILLART noreply at github.com
Fri Jan 10 00:55:31 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f4cbe7bf3972971aa4feba14a2e466b81af92980
      https://github.com/WebKit/WebKit/commit/f4cbe7bf3972971aa4feba14a2e466b81af92980
  Author: Théo Maillart <tmaillart at freebox.fr>
  Date:   2025-01-10 (Fri, 10 Jan 2025)

  Changed paths:
    M Source/JavaScriptCore/API/glib/JSCValue.cpp
    M Source/JavaScriptCore/API/glib/JSCValue.h.in
    M Tools/TestWebKitAPI/Tests/JavaScriptCore/glib/TestJSC.cpp

  Log Message:
  -----------
  [JSC][GLib] Provide deferred promise creation api
https://bugs.webkit.org/show_bug.cgi?id=283708

Reviewed by Carlos Garcia Campos.

This commit implements an API to create promises in JSC GLib.
It is a copy from the Objective-C valueWithNewPromiseInContext.
An executor is required, it will be invoked during promise initialization
and it receives the @resolve and @reject objects than can be called to resolve
or reject the promise. It is called like a js function, so exceptions raised
during the executor invocation will not be propagated to the context, but
handled by the promise causing a rejection.

* Source/JavaScriptCore/API/glib/JSCValue.cpp:
(jsc_value_new_promise):
* Source/JavaScriptCore/API/glib/JSCValue.h.in:
* Tools/TestWebKitAPI/Tests/JavaScriptCore/glib/TestJSC.cpp:
(fooSuccessSource):
(fooSuccessExecutor):
(getAsyncResolvedPromise):
(fooFailureSource):
(fooFailureExecutor):
(getAsyncRejectedPromise):
(getRejectedPromise):
(getExceptionPromise):
(getResolvedPromise):
(testJSCPromises):

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



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list