-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Consistently use Dom in native promise handlers #33604
Copy link
Copy link
Closed
Labels
A-content/scriptRelated to the script threadRelated to the script threadE-less-complexStraightforward. Recommended for a new contributor.Straightforward. Recommended for a new contributor.
Description
The "callbacks" for resolve and rejection of native promise handlers need to usually keep track of dom objects, and it's not clear what is the right primitive to use.
Dommay not be safe(mentioned by @jdm), but on the other hand the callbacks are stored on the dom_structPromiseNativeHandler, so I though using aDominside a nested structure would be safe.DomRootis meant only for rooting on the stack. But it is actually currently used in the native body handlersTrustedwas suggested by @jdm, and it is what I chose to use in the above PR. But it is meant fro cross-thread sharing(using arc), while the promise always resolves on the same thread albeit asynchronously.
To me it appears that we should either confirm that using Dom is safe, or otherwise introduce a new Trusted variant for single-threaded usage.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-content/scriptRelated to the script threadRelated to the script threadE-less-complexStraightforward. Recommended for a new contributor.Straightforward. Recommended for a new contributor.