[whatwg/streams] Should the underlying source be pinged for cancel when a close request exists? (Issue #1252)

```js
stream = new ReadableStream({
  start(c) {
    c.enqueue(new Uint8Array(8));
    c.close();
  },
  cancel() {
    console.log("cancellation happened");
  }
});
stream.cancel();
```

This calls the cancel callback, and this does not:

```js
stream = new ReadableStream({
  start(c) {
    c.enqueue(new Uint8Array(8));
    c.close();
  },
  cancel() {
    console.log("cancellation happened");
  }
});
reader = stream.getReader();
reader.read();
reader.cancel();
```

... as ReadableStreamCancel does not check `[[closeRequested]]`.

I think the underlying source is effectively done at the point it calls `controller.close()`, is there a reason it should be pinged for anything after that? Probably too late to change the behavior even if there's no need, though.

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

Message ID: <whatwg/streams/issues/1252@github.com>

Received on Saturday, 21 January 2023 12:33:56 UTC