Re: [whatwg/streams] TransformStream cleanup using "Transformer.cancel" (PR #1283)

@MattiasBuelens commented on this pull request.



> -   1. If |readable|.[=ReadableStream/[[state]]=] is "`errored`", throw
-      |readable|.[=ReadableStream/[[storedError]]=].

> Because the `controller` of the RS is not exposed to the user, it is not possible to close the RS without going thru `cancelAlgorithm` in the TS.

You can error the readable side by calling `TransformStreamDefaultController.error()`. So I believe this check is trying to handle some sort of race condition between `writer.close()` and `controller.error()`.

Perhaps it's to handle the case where `flush()` called `controller.error()` instead of rejecting?
```javascript
new TransformStream({
  flush(controller) {
    controller.error(new Error("Boom!"));
  }
})
```

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

Message ID: <whatwg/streams/pull/1283/review/1532417031@github.com>

Received on Monday, 17 July 2023 10:03:28 UTC