You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Responds to the review on the unhandled-promise-rejection handler:
- Implement the JavaScriptCore backend in this PR (no longer a follow-up).
AppRuntime_JavaScriptCore.cpp registers a JS callback via
JSGlobalContextSetUnhandledRejectionCallback (forward-declared SPI, guarded
with __builtin_available). JSC fires it at the microtask checkpoint only for
still-unhandled rejections, so the adapter is a thin direct report with no
candidate bookkeeping.
- Factor out the engine-agnostic bookkeeping into a shared header,
AppRuntime_PromiseRejection.h: ToError() plus a PromiseRejectionTracker<>
template that collects no-handler rejections, drops them on handler-added, and
reports survivors at end-of-turn. Included only by the V8/JSC TUs (the JSI
napi.h shim lacks the napi_value -> Napi::Value bridge ToError needs).
- Always track unhandled rejections (routed to UnhandledExceptionHandler):
removed the opt-in Options::EnableUnhandledPromiseRejectionTracking flag.
- V8 robustness fixes:
* Drain candidates into a local (std::move) before reporting, so a host
handler that synchronously rejects another promise cannot invalidate the
iterator mid-flush.
* Match handler-added events by promise object identity instead of
v8::Object::GetIdentityHash (which is not unique and could drop rejections).
- Tests: replace the runtime JSRUNTIMEHOST_NAPI_ENGINE string compare with a
compile-time gate. CMake now emits JSRUNTIMEHOST_NAPI_ENGINE_<engine> (e.g.
_V8, _JavaScriptCore) for both the desktop and Android UnitTests targets, and
the rejection tests compile their body only on supported engines.
- Consolidate the coverage documentation onto AppRuntime.h
(OnUnhandledPromiseRejection): V8 and JavaScriptCore supported; Chakra
(in-box/EdgeMode) and JSI no-op. Trim the scattered Chakra note accordingly.
Validated on Win32: V8 Release -- both AppRuntime rejection tests pass and
JavaScript.All stays green (203 passing) with always-on tracking; Chakra Debug
compiles and the rejection tests skip via the compile-time gate.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
0 commit comments