1 of 6

AsyncContext

Web integration update

Andreu Botella (Igalia)

July 2025

2 of 6

The story so far

  • The AsyncContext web integration touches a number of web APIs in non-trivial ways
  • Mozilla’s DOM team opposed the because of the web integration’s complexity and the possibility for introducing memory leaks
  • In the last plenary, we brainstormed about the web integration
    • Conclusion: async events should propagate the context, as long as it’s feasible to implement in browsers
    • Mozilla did not participate in the discussion, because the relevant DOM folks are not TC39 delegates

3 of 6

Updates from the Web Engines Hackfest

  • The week after the last plenary, Igalia organized the Web Engines Hackfest, an event that brings together people working on browser and JS engines
  • We had an AsyncContext session, with the relevant Mozilla DOM folks in the room
  • By the end, they were still concerned about the complexity and memory leaks, but they understood that the extensive web integration enables a lot of the proposal’s use cases

4 of 6

Analyzing the complexity

  • Some of the implementation complexity comes from APIs that can send messages to both same-agent and cross-agent destinations
  • The sender often doesn’t know whether the receiver is same-agent
  • Mozilla’s DOM folks asked us to investigate the following APIs:
    • MessageChannel
    • BroadcastChannel
    • IndexedDB
    • LocalStorage

5 of 6

Our work in response

  • We are prototyping an implementation of AsyncContext in Gecko, including the web integration for those APIs, and will publish a design doc
    • We want to show propagation can be implemented safely and without leaks
  • We have also refined the memory management document with better recommendations for the tradeoff between memory usage and GC performance

6 of 6

Next steps

  1. Work together with Mozilla to resolve any concerns they might have from our prototype and design doc
  2. Discuss the shape of the changes to web specifications with the HTML editors and other web spec stakeholders
  3. Open the relevant PRs to the web specifications
  4. Once that’s done, we will ask for stage 2.7