镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Update ongoing promise in async iterator return() method #51725

Description

@MattiasBuelens

There's an edge case with the current Web IDL bindings for async iterators where manually calling return(); next() could result in the next() promise resolving before the return() promise. The latest version of the Web IDL specification fixes this by updating the "ongoing promise" in the async iterator return() method.

For Node.js, this affects ReadableStream.prototype[Symbol.asyncIterator]. More specifically, this part needs to be changed:

return(error) {
return state.current ?
PromisePrototypeThen(
state.current,
() => returnSteps(error),
() => returnSteps(error)) :
returnSteps(error);
},

Activity

  1. aduh95 commented on Feb 12, 2024

    @aduh95
    Contributor

    /cc @nodejs/whatwg-stream

  2. mcollina commented on Feb 13, 2024

    @mcollina
    SponsorMember

    Good finding! Are you planning to send a PR to fix?

  3. MattiasBuelens commented on Feb 13, 2024

    @MattiasBuelens
    ContributorAuthor

    @mcollina Sure, I can do that. I'll wait for the spec change to land first.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues and PRs for confirmed bugs.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions