[whatwg/streams] "close a WritableStream" is not safe without checking WritableStreamCloseQueuedOrInFlight (Issue #1383)

saschanaz created an issue (whatwg/streams#1383)

### What is the issue with the Streams Standard?

From https://github.com/w3c/webtransport/issues/797,

WebTransport closes its writable stream as part of its cleanup steps, but [the corresponding algorithm](https://streams.spec.whatwg.org/#writablestream-close) directly calls WritableStreamClose without any check. And WritableStreamClose asserts that there's no queued close request. And thus if there was an existing [WritableStream.close()](https://streams.spec.whatwg.org/#ws-close) call from JS, this cleanup step triggers double close of the stream.

Should the close algorithm check WritableStreamCloseQueuedOrInFlight and bail out early?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/issues/1383
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/streams/issues/1383@github.com>

Received on Thursday, 1 October 2026 19:42:56 UTC