diff --git a/index.bs b/index.bs index c670f1c40..4b71b1265 100644 --- a/index.bs +++ b/index.bs @@ -2568,6 +2568,45 @@ nothrow>ReadableByteStreamControllerShouldCallPull ( controller ) console.error("Something broke", e)); + +
In addition to the principles for streams in general, a number of additional considerations have informed the design of +the WritableStream state machine. + +
Some of these design decisions improve predictability, ease-of-use, and safety for developers at the expense of +making implementations more complex. + +
Only one sink method can ever be executing at a time. +
Sink methods are treated as atomic. A new sink method will never be called until the Promise from the previous + one has resolved. Most changes to the internal state do not take effect until any in-flight sink method has completed. +
Exception: If something has happened that will error the stream, for example writer.abort() has been called, then + new calls to writer.write() will start failing immediately. There's no user benefit in waiting for the current operation + to complete before informing the user that writer.write() has failed. +
The writer.ready promise and the value of writer.desiredSize reflect whether a write() performed right + now would be effective. +
The writer.closed promise and the promises returned by writer.close() and writer.abort() do not resolve or + reject until no sink methods are executing and no further sink methods will be executed. +
Promises fulfill in consistent order. In particular, writer.ready always resolves before writer.closed, even + in cases where both are fulfilling in reaction to the same occurrence. +
WritableStream