Re: [whatwg/streams] First draft at a pipeTo "algorithm" (#512)

> +     * Closing must be propagated forward:
> +       * If *this*.[[state]] is or becomes `"closed"` and _preventClose_ is *false*, perform !
> +         WritableStreamDefaultWriterClose(_writer_). If the resulting promise fulfills, perform successful cleanup.
> +         Otherwise, perform error cleanup with the resulting promise rejection.
> +       * If *this*.[[state]] is or becomes `"closed"` and _preventClose_ is *true*, perform successful cleanup.
> +     * Closing must be propagated backward:
> +       * If _dest_.[[state]] is `"closing"` or `"closed"` and _preventCancel_ is *false*,
> +         1. Let _destClosed_ be a new *TypeError*.
> +         1. Perform ! ReadableStreamCancel(*this*, _destClosed_).
> +         1. If the resulting promise fulfills, perform error cleanup with _destClosed_. Otherwise, perform error cleanup
> +            with the resulting promise rejection.
> +       * If _dest_.[[state]] is `"closing"` or `"closed"` and _preventCancel_ is *true*, perform error cleanup with a
> +         new *TypeError*.
> +     * <i>Cleanup</i>: if any of the above requirements ask to perform cleanup, then:
> +       * Wait until any outstanding reads or writes finish (i.e. the corresponding promises settle). If that causes one
> +         of the above error conditions to be true, jump back to those requirements instead of proceeding with cleanup.

Depending on resolution of #476, we might need to mention the error situation where write() promise rejects but the destination writable stream doesn't get errored.

-- 
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/512/files/f8ae6ef8dce5202fa83f5a233f4c8a844b7722ae#r77575315

Received on Tuesday, 6 September 2016 05:33:49 UTC