[whatwg/streams] Add state checks to Close() and Enqueue() (#1029)

Exit early from abstract operations
ReadableStreamDefaultControllerClose() and
ReadableStreamDefaultControllerEnqueue() if
ReadableStreamDefaultControllerCanCloseOrEnqueue() is false. Remove the
asserts that it is true, and the requirement that callers perform the
check as part of the interface contract.

In practice the implementation of ReadableStreamTee() was failing to
properly check CanCloseOrEnqueue(). By relaxing the interface contract
we can prevent similar problems with future standards.

Also remove a now-redundant check of CanCloseOrEnqueue() in
TransformStreamDefaultControllerTerminate().

Also make similar changes to ReadableByteStreamControllerClose() and
ReadableByteStreamControllerEnqueue().
You can view, comment on, or merge this pull request online at:

  https://github.com/whatwg/streams/pull/1029

-- Commit Summary --

  * Add state checks to Close() and Enqueue()

-- File Changes --

    M index.bs (18)
    M reference-implementation/lib/readable-stream.js (26)
    M reference-implementation/lib/transform-stream.js (4)

-- Patch Links --

https://github.com/whatwg/streams/pull/1029.patch
https://github.com/whatwg/streams/pull/1029.diff

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

Received on Thursday, 27 February 2020 09:40:33 UTC