Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e88d4bd6eeac7fecedcc3039bb4a5d556b64a6fe
      
https://github.com/WebKit/WebKit/commit/e88d4bd6eeac7fecedcc3039bb4a5d556b64a6fe
  Author: Yusuke Suzuki <[email protected]>
  Date:   2025-10-13 (Mon, 13 Oct 2025)

  Changed paths:
    M Source/JavaScriptCore/API/JSAPIGlobalObject.cpp
    M Source/JavaScriptCore/API/JSAPIGlobalObject.mm
    M Source/JavaScriptCore/dfg/DFGOperations.cpp
    M Source/JavaScriptCore/jsc.cpp
    M Source/JavaScriptCore/runtime/JSGlobalObject.cpp
    M Source/JavaScriptCore/runtime/JSGlobalObject.h
    M Source/JavaScriptCore/runtime/JSMicrotask.cpp
    M Source/JavaScriptCore/runtime/JSModuleLoader.cpp
    M Source/JavaScriptCore/runtime/JSPromise.cpp
    M Source/JavaScriptCore/runtime/JSPromise.h
    M Source/JavaScriptCore/tools/JSDollarVM.cpp
    M Source/JavaScriptCore/wasm/WasmStreamingCompiler.cpp
    M Source/WebCore/bindings/js/JSDOMAsyncIterator.h
    M Source/WebCore/bindings/js/JSDOMGlobalObject.cpp
    M Source/WebCore/bindings/js/JSDOMPromise.cpp
    M Source/WebCore/bindings/js/JSDOMPromiseDeferred.cpp
    M Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
    M Source/WebCore/bindings/scripts/test/JS/JSTestCallbackInterface.cpp

  Log Message:
  -----------
  [JSC] Reduce possibly-error-throwing promise operation area
https://bugs.webkit.org/show_bug.cgi?id=300667
rdar://162563980

Reviewed by Yijia Huang.

This patch simplifies promise related hooks so that we can expand the
area of Promise code which does not throw an error. This improves
overall Promise operations stabilization, making some of WebCore
Promise handlings simplified.

1. We offer the default implementation of promiseRejectionTracker. And
   we always set promiseRejectionTracker. So we do not need to check a
   nullptr for this entry. We ensure that tracking code does not throw
   an error.
2. We make sure that queueMicrotaskToEventLoop will not throw an error.
   This should be just putting a task to MicrotaskQueue so it should be
   trivial.
3. Based on the above two changes, we clean up Promise code. When the
   operation will not throw an error, we take VM& first instead of
   JSGlobalObject*.

* Source/JavaScriptCore/API/JSAPIGlobalObject.cpp:
(JSC::JSAPIGlobalObject::globalObjectMethodTable):
* Source/JavaScriptCore/API/JSAPIGlobalObject.mm:
(JSC::JSAPIGlobalObject::globalObjectMethodTable):
(JSC::JSAPIGlobalObject::moduleLoaderFetch):
* Source/JavaScriptCore/dfg/DFGOperations.cpp:
(JSC::DFG::JSC_DEFINE_JIT_OPERATION):
* Source/JavaScriptCore/jsc.cpp:
(GlobalObject::moduleLoaderImportModule):
(GlobalObject::moduleLoaderFetch):
* Source/JavaScriptCore/runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::baseGlobalObjectMethodTable):
(JSC::JSC_DEFINE_HOST_FUNCTION):
(JSC::JSGlobalObject::promiseRejectionTracker):
* Source/JavaScriptCore/runtime/JSGlobalObject.h:
* Source/JavaScriptCore/runtime/JSMicrotask.cpp:
(JSC::promiseResolveThenableJobFastSlow):
(JSC::promiseResolveThenableJobWithoutPromiseFastSlow):
(JSC::runInternalMicrotask):
* Source/JavaScriptCore/runtime/JSModuleLoader.cpp:
(JSC::JSModuleLoader::importModule):
(JSC::JSModuleLoader::fetch):
(JSC::JSC_DEFINE_HOST_FUNCTION):
* Source/JavaScriptCore/runtime/JSPromise.cpp:
(JSC::JSPromise::rejectedPromise):
(JSC::JSPromise::reject):
(JSC::JSPromise::fulfill):
(JSC::JSPromise::performPromiseThenExported):
(JSC::JSPromise::rejectAsHandled):
(JSC::JSPromise::rejectWithCaughtException):
(JSC::JSPromise::performPromiseThen):
(JSC::JSPromise::rejectPromise):
(JSC::JSPromise::fulfillPromise):
(JSC::JSPromise::resolvePromise):
(JSC::JSC_DEFINE_HOST_FUNCTION):
(JSC::JSPromise::triggerPromiseReactions):
(JSC::JSPromise::resolveWithoutPromiseForAsyncAwait):
(JSC::JSPromise::then):
(JSC::JSPromise::promiseReject):
* Source/JavaScriptCore/runtime/JSPromise.h:
* Source/JavaScriptCore/tools/JSDollarVM.cpp:
(JSC::JSC_DEFINE_HOST_FUNCTION):
* Source/JavaScriptCore/wasm/WasmStreamingCompiler.cpp:
(JSC::Wasm::StreamingCompiler::fail):
* Source/WebCore/bindings/js/JSDOMAsyncIterator.h:
(WebCore::IteratorTraits>::next):
(WebCore::IteratorTraits>::runNextSteps):
* Source/WebCore/bindings/js/JSDOMGlobalObject.cpp:
(WebCore::JSDOMGlobalObject::moduleLoaderFetch):
(WebCore::JSDOMGlobalObject::moduleLoaderImportModule):
* Source/WebCore/bindings/js/JSDOMPromise.cpp:
(WebCore::DOMPromise::whenPromiseIsSettled):
* Source/WebCore/bindings/js/JSDOMPromiseDeferred.cpp:
(WebCore::DeferredPromise::callFunction):
* Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:
(GenerateCallbackImplementationOperationBody):
* Source/WebCore/bindings/scripts/test/JS/JSTestCallbackInterface.cpp:
(WebCore::JSTestCallbackInterface::callbackThatTreatsExceptionAsRejectedPromise):

Canonical link: https://commits.webkit.org/301454@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