Clean-up and improve spec-compliance for Array.fromAsync
Categories
(Core :: JavaScript: Standard Library, task)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox108 | --- | fixed |
People
(Reporter: anba, Assigned: anba)
References
Details
Attachments
(10 external files)
Clean-up Array.fromAsync to use consistent error reporting compared to other iteration code (for-of loops and Array.from), change the implementation to use a for-await loop, and properly unwrap Promise values from sync iterators.
| Assignee | ||
Comment 1•4 years ago
|
||
Reverts the whitespace change from the original Array.fromAsync patch.
| Assignee | ||
Comment 2•4 years ago
|
||
Later patches will rearrange this code again.
Depends on D160475
| Assignee | ||
Comment 3•4 years ago
|
||
Part 8 will actually remove the entire method.
Depends on D160476
| Assignee | ||
Comment 4•4 years ago
|
||
Noticed this when adding a test for the next part.
Depends on D160477
| Assignee | ||
Comment 5•4 years ago
|
||
This ensures Array.fromAsync uses the same error message as Array.from and
normal iteration (for-of and for-await-of).
This let's us also remove the GetIterator self-hosted function.
Also renamed asyncIterator to iterator, because the returned iterator isn't
an async iterator.
Depends on D160478
| Assignee | ||
Comment 6•4 years ago
|
||
asyncFromSyncIteratorObject[ASYNC_FROM_SYNC_ITERATOR_OBJECT_ITERATOR_SLOT] is
the iterator passed to CreateAsyncFromSyncIterator(), but we actually need to
use asyncFromSyncIteratorObject for the iteratorRecord to correctly unwrap
Promise values. (Same applies for the next method.)
Depends on D160479
| Assignee | ||
Comment 7•4 years ago
|
||
Change allowContentIterWith to support async iteration in preparation for the
next patch.
Depends on D160480
| Assignee | ||
Comment 8•4 years ago
|
||
Change Array.fromAsync to use a for-await loop. Simplifies the code and
should ensure Array.fromAsync handles iteration similar to other async
iteration code.
Depends on D160481
| Assignee | ||
Comment 9•4 years ago
|
||
Reorders steps 3.j-k to appear in the correct order and allows to remove some
empty blocks.
Depends on D160482
| Assignee | ||
Comment 10•4 years ago
|
||
Inlines GetMethod to ensure we can report JSMSG_NOT_ITERABLE, similar to
normal iteration or Array.from().
Depends on D160483
Comment 11•4 years ago
|
||
Comment 12•4 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/b6fe2484d1d2
https://hg.mozilla.org/mozilla-central/rev/65dd948e3a52
https://hg.mozilla.org/mozilla-central/rev/f2b0dfce1304
https://hg.mozilla.org/mozilla-central/rev/bfcb3e8f4a95
https://hg.mozilla.org/mozilla-central/rev/6eab189d4307
https://hg.mozilla.org/mozilla-central/rev/77964262799c
https://hg.mozilla.org/mozilla-central/rev/5461f671181d
https://hg.mozilla.org/mozilla-central/rev/b0f341e0cc09
https://hg.mozilla.org/mozilla-central/rev/f46ce4f4052a
https://hg.mozilla.org/mozilla-central/rev/8e24f1f58e0a
Description
•