[whatwg/streams] Permit closing the writable to close the readable, even with HWM 0 (#786)

Previously a call to writer.close() on a TransformStream with
readableStrategy.highWaterMark 0 and no chunks queued would not result
in the readable side being closed. This was because the backpressure
would mean that the promises returned by start() or write() would never
settle.

Instead of waiting for backpressure to clear at the end of every call to
sink start() and write(), instead wait for it to clear at the start of a
call to sink write(), before calling transformer.transform().

When there is no backpressure, write() will still call transform()
synchronously.

The results of only one test changed as a result of this. It has been
updated. A new test has been added to verify that writer.close() now
results in the readable being closed with HWM 0.
You can view, comment on, or merge this pull request online at:

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

-- Commit Summary --

  * Permit closing the writable to close the readable, even with HWM 0

-- File Changes --

    M reference-implementation/lib/transform-stream.js (24)
    M reference-implementation/to-upstream-wpts/transform-streams/backpressure.js (26)
    M reference-implementation/to-upstream-wpts/transform-streams/general.js (9)

-- Patch Links --

https://github.com/whatwg/streams/pull/786.patch
https://github.com/whatwg/streams/pull/786.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/786

Received on Friday, 1 September 2017 14:04:13 UTC