Open
Bug 1514315
Opened 7 years ago
Updated 3 years ago
Consider adding a dom::Promise => MozPromise adapter class
Categories
(Core :: DOM: Core & HTML, enhancement, P3)
Core
DOM: Core & HTML
Tracking
()
NEW
People
(Reporter: nika, Unassigned)
References
Details
Currently, if we have a MozPromise or dom::Promise, it's tricky to get the other type of promise. It would be nice to provide a helper class which does this adapting for you, rather than having to do it manually.
Updated•7 years ago
|
Priority: -- → P3
Comment 1•7 years ago
|
||
MozPromise and Promise are very different beasts, but I agree it would be nice to be able to have some helper thingie to adapt from one to another. And would be nice to have simpler ways to use Promise in C++. It is still a bit JS-y.
One issue is that MozPromises are about handling asynchronous chains in a certain way (or that is how I see them), but Promises aren't about asynchronousness (because they use microtasks).
We need to be careful to not make long non-asynchronous *Promise chains in browser code - it is already a rather bad issue in the web pages to use too long Promise chains, which cause jank.
So whatever we add need to be clear on that the conversion changes scheduling to something very different.
(microtasks were designed for MutationObserver to be able to coalesce several mutations to one, still effectively synchronous, notification. It was basically a performance optimization for an API which had to be somewhat synchronous. I can't recall all the reasoning why Promises also use microtasks.)
| Assignee | ||
Updated•7 years ago
|
Component: DOM → DOM: Core & HTML
See Also: → 1713754
Updated•3 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•