Closed
Bug 1355597
Opened 7 years ago
Closed 7 years ago
Passing an empty array to MozPromise::All doesn't behave nicely
Categories
(Core :: XPCOM, enhancement)
Core
XPCOM
Tracking
()
RESOLVED
FIXED
mozilla55
Tracking | Status | |
---|---|---|
firefox55 | --- | fixed |
People
(Reporter: nika, Assigned: nika)
Details
Attachments
(1 file)
1.74 KB,
patch
|
jwwang
:
review+
|
Details | Diff | Splinter Review |
The resulting promise will never resolve if MosPromise::All is passed an empty nsTArray, and in fact seems to assert (confusingly) here: http://searchfox.org/mozilla-central/rev/624d25b2980cf5f83452b040e6d664460f9b7ec5/xpcom/threads/MozPromise.h#384 when run locally. It should probably take one of the following behaviors: a) Resolve with an empty nsTArray as its value upon creation. b) MOZ_ASSERT(mResolveValues.Length() > 0) in the constructor. Another option would be to reject, however there was no error, so that seems like a surprising behavior. I was expecting the behavior of this method to follow JS's behavior, which is a). If we decide that is undesirable I think the MOZ_ASSERT is the next best option. I will attach a patch which implements JS's behavior, as I think this is the best option.
Assignee | ||
Comment 1•7 years ago
|
||
MozReview-Commit-ID: Knhm0N9huuo
Attachment #8857167 -
Flags: review?(bobbyholley)
Bobby is always busy these. If you don't hear from him, I would recommend :jwwang, who now has the most current experience with hacking&using MozPromise. I'd personally prefer option 'a' (resolve with an empty array) : It's consistent with Javascript's Promise.all(), and seems logical to me.
Comment 3•7 years ago
|
||
Comment on attachment 8857167 [details] [diff] [review] Support passing empty arrays to MozPromise::All Review of attachment 8857167 [details] [diff] [review]: ----------------------------------------------------------------- LGTM.
Attachment #8857167 -
Flags: review?(bobbyholley) → review+
Pushed by michael@thelayzells.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/89305c2348d8 Support passing empty arrays to MozPromise::All, r=jwwang
Comment 5•7 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/89305c2348d8
Status: NEW → RESOLVED
Closed: 7 years ago
status-firefox55:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in
before you can comment on or make changes to this bug.
Description
•