Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

strategySizeAlgorithm validation in WritableStreamDefaultControllerGetChunkSize #1341

Open
daeyeon opened this issue Mar 2, 2025 · 1 comment

Comments

@daeyeon
Copy link

daeyeon commented Mar 2, 2025

What is the issue with the Streams Standard?

Hi, while reviewing an issue in Node.js, I noticed a case where the stream's state is 'closed' when getting the chunk size, after the sizeAlgorithm has been cleared.

i. writableStreamDefaultWriterClose
ii. writableStreamClose
iii. writableStreamDefaultControllerClose
iv. writableStreamDefaultControllerAdvanceQueueIfNeeded
v. WritableStreamDefaultControllerProcessClose(controller)

  1. Perform ! WritableStreamDefaultControllerClearAlgorithms(controller).
  1. Set controller.[[strategySizeAlgorithm]] to undefined.

7.1. Perform ! WritableStreamFinishInFlightClose(stream).

  1. Set stream.[[state]] to "closed".

However, the current assertion below only checks erroring or errored states.

WritableStreamDefaultControllerGetChunkSize(controller, chunk) performs the following steps:

  1. If controller.[[strategySizeAlgorithm]] is undefined, then:
    1.1. Assert: controller.[[stream]].[[state]] is "erroring" or "errored".
    1.2. Return 1.
@domenic
Copy link
Member

domenic commented Mar 3, 2025

This is a consequence of 86d07e9.

Presumably we should just widen the assertion, but also be sure to add a test while we're doing so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants