Functions that create resolved/rejected promises are byzantine
Categories
(Core :: JavaScript: Standard Library, task)
Tracking
()
Tracking | Status | |
---|---|---|
firefox74 | --- | fixed |
People
(Reporter: Waldo, Assigned: Waldo)
Details
Attachments
(2 files)
The code underneath PromiseObject::unforgeable{Resolve,Reject}
is byzantine -- you gotta get the original Promise
constructor and feed that through a mess of APIs that do a whole bunch of work. But really, there's no reason this can't be much more than a moral equivalent of StringObject::create
, if we boil away a bunch of make-work. And we should.
This also has the benefit of giving PromiseObject::unforgeableReject
a better return type, and we can split out a PromiseObject::unforgeableResolveWithNonPromise
that knowledgeable users can use to avoid a bunch of work. (PromiseObject::unforgeableResolve
, sadly, still has to do work for the case where the provided value is a promise. Maybe in followup work we could just have that function detect, then call, either the non-promise version or a new PromiseObject::unforgeableResolvePromise
that only handles the case of being passed in a promise.)
Assignee | ||
Comment 1•4 years ago
|
||
Depends on D58848
Updated•4 years ago
|
Assignee | ||
Comment 2•4 years ago
|
||
Depends on D59231
Updated•4 years ago
|
Pushed by jwalden@mit.edu: https://hg.mozilla.org/integration/autoland/rev/674372340cf5 Make |ReadableStreamAddReadOrReadIntoRequest| return |PromiseObject*| for more specificity. r=arai https://hg.mozilla.org/integration/autoland/rev/9f267cbec223 Inline a whole bunch of flab from the wholly-generic unforgeable{Resolve,Reject} functions and provide forms of them that return PromiseObject* (perhaps if arguments are sufficiently restrictive). r=arai
Comment 4•4 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/674372340cf5
https://hg.mozilla.org/mozilla-central/rev/9f267cbec223
Description
•