Skip to content

strategySizeAlgorithm validation in WritableStreamDefaultControllerGetChunkSize #1341

Closed

Description

@daeyeon

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.

Activity

  1. domenic commented on Mar 3, 2025

    @domenic
    Member

    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.

  2. added a commit that references this issue on Apr 7, 2025
  3. added a commit that references this issue on Apr 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions