[whatwg/webidl] Close iterators when conversion fails while creating a sequence from an iterator (PR #1662)

Match ECMAScript behavior: when interrupted while consuming an iterator, such as from an exception not caused by the iterator itself, close that iterator. Also applied to async iterables, although this is not yet observable since the only consumer is Streams which converts to `async_sequence<any>` and so cannot fail.

- [ ] At least two implementers are interested (and none opposed):
   * Safari (already implements this behavior)
   * …
- [ ] [Tests](https://github.com/web-platform-tests/wpt) are written and can be reviewed and commented upon at:
   * … <!-- If these tests are tentative, link a PR to make them non-tentative. -->
- [ ] [Implementation bugs](https://github.com/whatwg/meta/blob/main/MAINTAINERS.md#handling-pull-requests) are filed:
   * Chromium: …
   * Gecko: …
   * WebKit: N/A
   * Deno: …
   * Node.js: …
   * webidl2.js: …
   * widlparser: …
- [ ] [MDN issue](https://github.com/whatwg/meta/blob/main/MAINTAINERS.md#handling-pull-requests) is filed: …
- [x] The top of this comment includes a [clear commit message](https://github.com/whatwg/meta/blob/main/COMMITTING.md) to use.
You can view, comment on, or merge this pull request online at:

  https://github.com/whatwg/webidl/pull/1662

-- Commit Summary --

  * Close iterators when conversion fails while creating a sequence from an iterator
  * Close async iterators when conversion fails
  * Make the reason for closing an async iterator optional

-- File Changes --

    M index.bs (15)

-- Patch Links --

https://github.com/whatwg/webidl/pull/1662.patch
https://github.com/whatwg/webidl/pull/1662.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/webidl/pull/1662
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/webidl/pull/1662@github.com>

Received on Friday, 6 November 2026 05:18:50 UTC