If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

DOM Promise should support iterables

RESOLVED FIXED in mozilla31

Status

()

Core
DOM
RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: nsm, Assigned: nsm)

Tracking

(Blocks: 1 bug)

unspecified
mozilla31
x86_64
Linux
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

The promise spec specifies iterables, but Spidermonkey currently does not have an API for dealing with iterables, presumably because the iterable spec is still in flux? FWIW Chromium doesn't support iterables either.
Blocks: 939332
Bug 952873 is asking for the API you need here, right?
Depends on: 952873
Though whether the API added there will help you is hard to tell without knowing what exactly the spec says.  Can you please link to the relevant spec bit?
Yes, that should be sufficient. https://github.com/domenic/promises-unwrapping#promiserace--iterable-
similarly for Promise.all() above it.
Whiteboard: [mentor=nsm.nikhil@gmail.com]
Whiteboard: [mentor=nsm.nikhil@gmail.com] → [mentor=nsm.nikhil@gmail.com][lang=c++]

Updated

4 years ago
Blocks: 885333
With bug 952890 fixed, is there anything to do here?
Flags: needinfo?(nsm.nikhil)
Created attachment 8398128 [details] [diff] [review]
Tests to check Promises can accept iterators.

No changes required, just adding tests.
Attachment #8398128 - Flags: review?(bzbarsky)
Assignee: nobody → nsm.nikhil
Flags: needinfo?(nsm.nikhil)
Whiteboard: [mentor=nsm.nikhil@gmail.com][lang=c++]
Comment on attachment 8398128 [details] [diff] [review]
Tests to check Promises can accept iterators.

>+      setTimeout(resolve.bind(undefined, 20), 20);

This could just be setTimeout(resolve, 20, 20), but either way.

>+    is(winner, 10, "Winner should be the one that finished earlier.");

This can fail, and then the sheriffs will hate you.  ;)  For example, say the process gets suspended for 11ms between the first setTimeout call and the second one.  Then the 20 will be scheduled before the 10.

You need to reverse the order of those calls to setTimeout.

r=me with that fixed.
Attachment #8398128 - Flags: review?(bzbarsky) → review+
Created attachment 8398537 [details] [diff] [review]
Tests to check Promises can accept iterators. r=bz
Attachment #8398128 - Attachment is obsolete: true
Attachment #8398537 - Flags: review+
https://hg.mozilla.org/integration/mozilla-inbound/rev/25d0630ab47d
https://hg.mozilla.org/mozilla-central/rev/25d0630ab47d
Status: NEW → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla31
You need to log in before you can comment on or make changes to this bug.