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

stream: fix sizeAlgorithm validation in WritableStream #57280

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

daeyeon
Copy link
Member

@daeyeon daeyeon commented Mar 2, 2025

sizeAlgorithm seems to be set to undefined when the stream is closed as well. This patch adds the unchecked closed state to the assertion.

https://streams.spec.whatwg.org/#writable-stream-default-controller-process-close

WritableStreamDefaultControllerProcessClose(controller) performs the following steps:

  1. Perform ! WritableStreamDefaultControllerClearAlgorithms(controller). <- Set strategySizeAlgorithm to undefined.
    7.1 Perform ! WritableStreamFinishInFlightClose(stream). <- Set stream.[[state]] to "closed".

Fixes: #57272
Refs: #56067

Signed-off-by: Daeyeon Jeong <daeyeon.dev@gmail.com>
@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. web streams labels Mar 2, 2025
Copy link

codecov bot commented Mar 2, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.24%. Comparing base (6b0af17) to head (6dd78fb).
Report is 16 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #57280   +/-   ##
=======================================
  Coverage   90.24%   90.24%           
=======================================
  Files         630      630           
  Lines      184908   184910    +2     
  Branches    36181    36188    +7     
=======================================
+ Hits       166874   166879    +5     
- Misses      11061    11064    +3     
+ Partials     6973     6967    -6     
Files with missing lines Coverage Δ
lib/internal/webstreams/writablestream.js 99.85% <100.00%> (+<0.01%) ⬆️

... and 33 files with indirect coverage changes

@daeyeon daeyeon added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Mar 3, 2025
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Mar 3, 2025
@nodejs-github-bot
Copy link
Collaborator

Copy link
Contributor

@gurgunday gurgunday left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@nodejs-github-bot
Copy link
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. needs-ci PRs that need a full CI run. web streams
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Closed WritableStream causes ERR_INTERNAL_ASSERTION
6 participants