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•6 years ago
|
||
Depends on D58848
Updated•6 years ago
|
Assignee | ||
Comment 2•6 years ago
|
||
Depends on D59231
Updated•6 years ago
|
Comment 4•6 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/674372340cf5
https://hg.mozilla.org/mozilla-central/rev/9f267cbec223
Description
•