[whatwg/streams] In pipeTo spec, the order of checking for shuttingDown disagrees with ref. impl. (#934)

In the spec for `pipeTo` at https://streams.spec.whatwg.org/#rs-pipe-to at the `Shutdown` and `Shutdown with an action` sub steps, the ordering is a) wait for writes b) check `shuttingDown` c) set `shuttingDown` to true.

The reference implementation implements this as: b, c, a, that is _first_ check if `shuttingDown` was set and only do the rest if not. See: https://github.com/whatwg/streams/blob/master/reference-implementation/lib/readable-stream.js#L216

I found this while making my own implementation of the streams standard, (see https://github.com/stardazed/sd-streams) By changing this order, a few of the wpt/streams/piping tests fail I believe. More generally, while the pipeTo spec text claims there is some leeway in the implementation, some tests rely on an exact ordering of Promise resolves that I could only fix by looking at and precisely emulating the reference implementation.

Anyway, my implementation is very close to the exact spec and passes all tests, except for the detached buffers for obvious reasons. I made it mostly to use the full streams spec in my browser based framework but perhaps it'll be useful to someone here or elsewhere. Thanks.

-- 
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/issues/934

Received on Thursday, 28 June 2018 14:40:03 UTC