[streams] Revisiting what's reasonable return value for each method of the controller (#424)

The return value of the controller methods are kinda inconsistent/strange in the following point.

- `ReadableStreamController.close()` when the stream is already closed
  - I remember in some issue/PR I (or domenic??) said "because a stream may get closed by cancel() which is an action by the consumer, blaming the controller for unsolicited closure (i.e. _closeRequested === false) is not good." or something and decided not to throw for this case.
  - But the controller is notified of cancel. Calling close() after receiving cancel signal should be considered to be ... misbehaving?
- The same for `ReadableStreamController.enqueue()`
- They're inconsistent with `ReadableStreamController.error()`. It fails if the stream is either closed or errored.
- When the stream is errored, `ReadableStreamController.error()` throws the stored error while `close()` throws a TypeError. I think both should throw a TypeError saying "you're misbehaving".

Chromium has shipped it but it's not too late to fix them if necessary. They're "fixed" in RBSController being redesigned in https://github.com/whatwg/streams/issues/379 based on my thoughts. I'd like to get your opinion on this.

---
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/issues/424

Received on Friday, 15 January 2016 14:19:26 UTC