- From: Mattias Buelens <notifications@github.com>
- Date: Wed, 14 Jul 2021 15:04:18 -0700
- To: whatwg/streams <streams@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/streams/pull/1130/review/706759770@github.com>
@MattiasBuelens commented on this pull request. > -<p algorithm>To <dfn export for="ReadableStream">close</dfn> a {{ReadableStream}} |stream|, perform -! [$ReadableStreamDefaultControllerClose$](|stream|.[=ReadableStream/[[controller]]=]). +<p algorithm>A {{ReadableStream}} <dfn export for="ReadableStream" lt="need more data|needs +more data">needs more data</dfn> if its [=ReadableStream/desired size to fill up to the high water +mark=] is greater than zero. + +<div algorithm> + To <dfn export for="ReadableStream">close</dfn> a {{ReadableStream}} |stream|: + + 1. If |stream|.[=ReadableStream/[[controller]]=] [=implements=] {{ReadableByteStreamController}}, + 1. Perform ! + [$ReadableByteStreamControllerClose$](|stream|.[=ReadableStream/[[controller]]=]). + 1. If |stream|.[=ReadableStream/[[controller]]=].[=ReadableByteStreamController/[[pendingPullIntos]]=] + is not [=list/is empty|empty=], perform ! + [$ReadableByteStreamControllerRespond$](|stream|.[=ReadableStream/[[controller]]=], 0). + <p class="note">The caller has to make sure not to write into the > The calling specification must never transfer the current BYOB request view. Note: implementations could do something equivalent to a transfer, but in that case they'd need to modify the steps in close to use RespondWithNewView instead of Respond(,0) to keep the same observable behavior as not transfering. That's correct. Do we want to provide an algorithm for closing a readable byte stream after the calling specification has already transferred the current BYOB request view? Or maybe add an optional `newByobBuffer` argument and switch on that to use either `Respond(0)` or `RespondWithNewView(emptyViewOnNewByobBuffer)`? > The calling specification must not write into the current BYOB request view after closing the stream. Makes sense. If they write into the BYOB request, they should enqueue it first, and *then* close the stream. -- 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/1130#discussion_r669985568
Received on Wednesday, 14 July 2021 22:04:31 UTC