Implement the Promise.any proposal
Categories
(Core :: JavaScript: Standard Library, enhancement, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox72 | --- | fixed |
People
(Reporter: alex.fdm, Assigned: anba)
References
(Blocks 1 open bug, )
Details
Attachments
(11 files)
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details |
This proposal is currently in Stage 2.
Comment 1•5 years ago
|
||
The proposal is now at stage 3 and ready for implementations: https://github.com/tc39/proposal-promise-any
Note that this includes AggregateError as well.
Updated•5 years ago
|
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 2•5 years ago
|
||
GlobalObject.h had an unnecessary #include for ErrorObject.h, which led to
recompiling more or less all of SpiderMonkey when modifying ErrorObject.h,
because GlobalObject.h is (transitively) included in most files.
Assignee | ||
Comment 3•5 years ago
|
||
The ErrorObject classes are already declared in ErrorObject.h, so it seems
useful to also move their definitions into the corresponding cpp file.
Also adds js::CaptureStack
to jsexn.h so it can be called from ErrorObject.cpp
and to remove the duplicated implementation in JSContext.cpp.
Depends on D51649
Assignee | ||
Comment 4•5 years ago
|
||
Update the #includes after moving the code in part 2.
Depends on D51651
Assignee | ||
Comment 5•5 years ago
|
||
Adds AggregateError, but only enables it for Nightly builds, because the draft
proposal is still incomplete, so it doesn't make sense to let this feature ride
the trains at this moment.
-
The
other_error_properties
array was changed to individual static variables,
because AggregateError has more than three properties, which prevents it to be
stored inJSPropertySpec[][3]
. -
AggregateErrorObject
can't use the normalErrorObject
class, because it
needs an additional slot for the [[AggregateErrors]]. -
For similar reasons it can't use the shared
Error
constructor function,
because theAggregateError
constructor has an additionalerrors
iterable
argument which it needs to process.
Depends on D51652
Assignee | ||
Comment 6•5 years ago
|
||
The draft propsal calls Promise.all
, Promise.allSetteld
, Promise.any
, and
Promise.race
"Promise combinators". Let's reuse that name to avoid having to
spell each function name in shared functions. For example instead of
CommonStaticAllRace
, or soon CommonStaticAllRaceAny
, we get
CommonPromiseCombinator
.
PromiseAllDataHolder
is currently used forPromise.all
and
Promise.allSettled
, and soon also forPromise.any
. Rename it to
PromiseCombinatorDataHolder
to express that different Promise combinators use
this object.
Depends on D51653
Assignee | ||
Comment 7•5 years ago
|
||
Moves the NewNativeFunction
and the two setExtendedSlot
calls into a helper
function to reduce code duplication.
Depends on D51654
Assignee | ||
Comment 8•5 years ago
|
||
The first five steps in each Promise combinator element function are always the
same. Add a helper function for this task to reduce more code duplication.
Depends on D51655
Assignee | ||
Comment 9•5 years ago
|
||
Adds a separate struct to hold the elements arrays and to apply wrapping and
unwrapping at the correct points. This will let us avoid copying this code
another time for the Promise.any
proposal.
Depends on D51656
Assignee | ||
Comment 10•5 years ago
|
||
As with AggregateError, Promise.any
is only enabled in Nightly.
Now that everything is in place, the actual Promise.any
implementation is
relatively straight forward. The only tricky part is probably just the
ThrowAggregateError
function, when the async stack is created to give a
better stack trace.
Depends on D51658
Assignee | ||
Comment 11•5 years ago
|
||
Depends on D51659
Assignee | ||
Updated•5 years ago
|
Comment 12•5 years ago
|
||
Comment 13•5 years ago
|
||
Comment 14•5 years ago
|
||
Backed out 10 changesets (Bug 1568903) for causing mochitest failures
Failure log: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=276407173&repo=autoland&lineNumber=4012
https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=276404600&repo=autoland&lineNumber=28477
Backout: https://hg.mozilla.org/integration/autoland/rev/cfe990fab350df1c36c24affdac448f7932379aa
Assignee | ||
Comment 15•5 years ago
|
||
Depends on D51660
Assignee | ||
Updated•5 years ago
|
Comment 16•5 years ago
|
||
Comment 17•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/12503fb17ac5
https://hg.mozilla.org/mozilla-central/rev/a49b752bfeee
https://hg.mozilla.org/mozilla-central/rev/2378a03445a7
https://hg.mozilla.org/mozilla-central/rev/b1811bdf29c0
https://hg.mozilla.org/mozilla-central/rev/5aa617ae468c
https://hg.mozilla.org/mozilla-central/rev/182fe08e0d52
https://hg.mozilla.org/mozilla-central/rev/08498010c540
https://hg.mozilla.org/mozilla-central/rev/e7097ccc33a9
https://hg.mozilla.org/mozilla-central/rev/936031ae609c
https://hg.mozilla.org/mozilla-central/rev/3f147b35398c
https://hg.mozilla.org/mozilla-central/rev/196a50e2cdd6
Assignee | ||
Comment 18•5 years ago
|
||
Filed bug 1599434 and bug 1599435 for adding AggregateError
support to devtools and PromiseWorker.
Comment 19•5 years ago
|
||
Removing DDN; we'll track this using https://bugzilla.mozilla.org/show_bug.cgi?id=1599769 instead.
Description
•