Skip to content
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

[[stream]] can not be undefined in "get the next iteration result" #1246

Closed
evilpie opened this issue Oct 18, 2022 · 1 comment · Fixed by #1247
Closed

[[stream]] can not be undefined in "get the next iteration result" #1246

evilpie opened this issue Oct 18, 2022 · 1 comment · Fixed by #1247

Comments

@evilpie
Copy link

evilpie commented Oct 18, 2022

Step 2 of https://streams.spec.whatwg.org/#rs-asynciterator-prototype-next should be impossible. The reader is acquired internally, so the stream can only become undefined after some kind of error or after finishing the iteration.

https://webidl.spec.whatwg.org/#es-asynchronous-iterator-prototype-object tells us that "getting the next iteration result" in Step 8.4 can not be invoked when the iteration is finished (Step 8.2).

@MattiasBuelens
Copy link
Collaborator

You're right, this can be an assert. 👍

Same thing for the async iterator return steps: Web IDL guarantees that this will only be called when the iterator's "is finished" is still false, and it immediately sets it to true after running those steps for the first (and only) time.

The Web IDL machinery for async iteration did not yet exist when we first specced this in #980, so these checks were necessary back then. But nowadays, we can rely on Web IDL instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants