-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ReadableStream @@asyncIterator #15097
ReadableStream @@asyncIterator #15097
Conversation
651f1f3
to
3468631
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
We should land this at the same time as the standard changes.
I still want to add two more tests that were originally suggested:
I'll look into adding them. |
Last few tests added. Now it's just a matter of fixing the reference implementation to pass them... EDIT: Reference implementation is passing again. |
Still lgtm with latest changes. |
Is this behind a flag at Chromium? |
No. See https://bugs.chromium.org/p/chromium/issues/detail?id=929585. |
Add tests for async-iterating a
ReadableStream
. See whatwg/streams#980 for the accompanying spec change.This PR continues from @devsnek's work in #13362.
The tests are based on Domenic's comment in whatwg/streams#954. So far, the following tests have been implemented:
c.enqueue()
instart
) that enqueues all at oncec.enqueue()
"just in time" (i.e. inside the loop body)c.enqueue()
inpull
) using recordingReadableStream to verify the correct underlying source method calls@@asyncIterator()
method is===
togetIterator()
methodreturn()
causes a cancelthrow
ing inside the loop body causes a cancelbreak
ing inside the loop body causes a cancelreturn
ing inside the loop body causes a cancelpreventCancel: true
and the pass conditions reversed.closed
promise after exhausting the async iterator via for-await-of.closed
promise afterreturn()
ing from the async iterator (either manually or viabreak
; take your pick)