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

%WrapForValidAsyncIteratorPrototype%.next does not validate result #204

Closed
2767mr opened this issue Jul 18, 2022 · 3 comments · Fixed by #205
Closed

%WrapForValidAsyncIteratorPrototype%.next does not validate result #204

2767mr opened this issue Jul 18, 2022 · 3 comments · Fixed by #205

Comments

@2767mr
Copy link
Contributor

2767mr commented Jul 18, 2022

All variations of .next throw or reject if the result is not an object except for %WrapForValidAsyncIteratorPrototype%.next.
This is because IteratorNext is used to do that check but IteratorNext only checks if the result is an object, which also returns true for promises.

An example:

let foo = {
    [Symbol.asyncIterator]() {
         return {
              async next() {
                  return null;
              }
         }
    }
}
await AsyncIterator.from(foo).next(); //Should throw TypeError but does not
@zloirock
Copy link
Contributor

#197 -> #190

@2767mr
Copy link
Contributor Author

2767mr commented Jul 18, 2022

If this intended then the check should be removed from %WrapForValidIteratorPrototype%.next as well or at least noted in the readme.

@bakkot
Copy link
Collaborator

bakkot commented Jul 18, 2022

Removing the check from %WrapForValidIteratorPrototype%.next sounds good to me.

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

Successfully merging a pull request may close this issue.

3 participants