Skip to content

Asynccontext error events#12366

Open
andreubotella wants to merge 3 commits intowhatwg:mainfrom
andreubotella:asynccontext-error-events
Open

Asynccontext error events#12366
andreubotella wants to merge 3 commits intowhatwg:mainfrom
andreubotella:asynccontext-error-events

Conversation

@andreubotella
Copy link
Copy Markdown
Member

@andreubotella andreubotella commented Apr 13, 2026

This patch adds AsyncContext support for error and promise rejection events. It builds on top of #12152.

This PR is part of #10432.

  • At least two implementers are interested (and none opposed):
  • Tests are written and can be reviewed and commented upon at:
  • Implementation bugs are filed:
    • Chromium: …
    • Gecko: …
    • WebKit: …
    • Deno (only for timers, structured clone, base64 utils, channel messaging, module resolution, web workers, and web storage): …
    • Node.js (only for timers, structured clone, base64 utils, channel messaging, and module resolution): …
  • Corresponding HTML AAM & ARIA in HTML issues & PRs:
  • MDN issue is filed: …
  • The top of this comment includes a clear commit message to use.

(See WHATWG Working Mode: Changes for more details.)


/canvas.html ( diff )
/dnd.html ( diff )
/imagebitmap-and-animations.html ( diff )
/index.html ( diff )
/infrastructure.html ( diff )
/interaction.html ( diff )
/references.html ( diff )
/scripting.html ( diff )
/timers-and-user-prompts.html ( diff )
/webappapis.html ( diff )

This PR updates HTML to integrate with the TC39 AsyncContext proposal,
which allows storing state associated with an async flow of execution
in JavaScript, and preserving it across different kinds of async
continuations in both JS and the web platform.

This PR does not yet handle events, since the exact behavior of those
with AsyncContext is still pending to be fully decided. But it covers
microtasks, timers, deferred script execution, focus/blur and others.

This patch does not include any changes to the `error` and
`unhandledrejection` event handling, as well as to
`HostEnqueueFinalizationRegistryCleanupJob`. This relies on the
assumption that the changes in tc39/proposal-async-context#148 and
tc39/proposal-async-context#150 will be accepted. Otherwise, error
contexts will need to be handled in HTML.

This patch relies on PR [TODO] to define the
`[PropagatesAsyncContext]` extended attribute in WebIDL.
This patch adds AsyncContext support for error and promise rejection
events. It builds on top of whatwg#12152.

This PR is part of #104432.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant