stream: handle undefined chunks correctly in decode stream
Align TextDecoderStream behavior with WPT requirements by treating undefined chunks as errors. This change ensures that TextDecoderStream properly handles unexpected chunk types and throws an error when receiving undefined input.
This update addresses the failing WPT for decode stream error handling.
Review requested:
- [ ] @nodejs/web-standards
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 88.24%. Comparing base (
e32521a) to head (cc89cf2). Report is 343 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #55153 +/- ##
==========================================
- Coverage 88.24% 88.24% -0.01%
==========================================
Files 651 651
Lines 183930 183865 -65
Branches 35850 35823 -27
==========================================
- Hits 162311 162244 -67
- Misses 14918 14929 +11
+ Partials 6701 6692 -9
| Files with missing lines | Coverage Ξ | |
|---|---|---|
| lib/internal/webstreams/encoding.js | 100.00% <100.00%> (ΓΈ) |
Looks good other than throwing ERR_INVALID_THIS. ERR_INVALID_ARG_TYPE is likely a better error to be thrown here.
Thank you for the suggestion! Iβve updated the code to throw ERR_INVALID_ARG_TYPE instead of ERR_INVALID_THIS as per your recommendation. I appreciate the feedback : )
CI: https://ci.nodejs.org/job/node-test-pull-request/62843/
Commit Queue failed
- Loading data for nodejs/node/pull/55153 β Done loading data for nodejs/node/pull/55153 ----------------------------------- PR info ------------------------------------ Title stream: handle undefined chunks correctly in decode stream (#55153) β Could not retrieve the email or name of the PR author's from user's GitHub profile! Branch Nahee-Park:fix-text-decoder-stream -> nodejs:main Labels author ready, needs-ci, web streams Commits 2 - stream: handle undefined chunks correctly in decode stream - stream: throw ERR_INVALID_ARG_TYPE instead of ERR_INVALID_THIS Committers 1 - Nahee-Park <[email protected]> PR-URL: https://github.com/nodejs/node/pull/55153 Reviewed-By: Mattias Buelens <[email protected]> Reviewed-By: Matthew Aitken <[email protected]> ------------------------------ Generated metadata ------------------------------ PR-URL: https://github.com/nodejs/node/pull/55153 Reviewed-By: Mattias Buelens <[email protected]> Reviewed-By: Matthew Aitken <[email protected]> -------------------------------------------------------------------------------- βΉ This PR was created on Sat, 28 Sep 2024 16:09:29 GMT β Approvals: 2 β - Mattias Buelens (@MattiasBuelens): https://github.com/nodejs/node/pull/55153#pullrequestreview-2335819701 β - Matthew Aitken (@KhafraDev): https://github.com/nodejs/node/pull/55153#pullrequestreview-2335879581 β Last GitHub CI successful βΉ Last Full PR CI on 2024-09-29T15:29:57Z: https://ci.nodejs.org/job/node-test-pull-request/62843/ - Querying data for job/node-test-pull-request/62843/ β Last Jenkins CI successful -------------------------------------------------------------------------------- β No git cherry-pick in progress β No git am in progress β No git rebase in progress -------------------------------------------------------------------------------- - Bringing origin/main up to date... From https://github.com/nodejs/node * branch main -> FETCH_HEAD β origin/main is now up-to-date - Downloading patch for 55153 From https://github.com/nodejs/node * branch refs/pull/55153/merge -> FETCH_HEAD β Fetched commits as bbf08c6a1bef..cc89cf23dee8 -------------------------------------------------------------------------------- [main 16d27d5e63] stream: handle undefined chunks correctly in decode stream Author: Nahee-Park <[email protected]> Date: Sat Sep 28 23:40:33 2024 +0900 2 files changed, 3 insertions(+), 7 deletions(-) [main ba985b3895] stream: throw ERR_INVALID_ARG_TYPE instead of ERR_INVALID_THIS Author: Nahee-Park <[email protected]> Date: Sun Sep 29 19:07:21 2024 +0900 1 file changed, 2 insertions(+), 1 deletion(-) β Patches applied There are 2 commits in the PR. Attempting autorebase. Rebasing (2/4)https://github.com/nodejs/node/actions/runs/11110112478Executing: git node land --amend --yes --------------------------------- New Message ---------------------------------- stream: handle undefined chunks correctly in decode stream
Align TextDecoderStream behavior with WPT requirements by treating undefined chunks as errors. This change ensures that TextDecoderStream properly handles unexpected chunk types and throws an error when receiving undefined input.
This update addresses the failing WPT for decode stream error handling.
PR-URL: https://github.com/nodejs/node/pull/55153 Reviewed-By: Mattias Buelens <[email protected]> Reviewed-By: Matthew Aitken <[email protected]>
[detached HEAD dcd4d048ce] stream: handle undefined chunks correctly in decode stream Author: Nahee-Park <[email protected]> Date: Sat Sep 28 23:40:33 2024 +0900 2 files changed, 3 insertions(+), 7 deletions(-) Rebasing (3/4) Rebasing (4/4)
Executing: git node land --amend --yes --------------------------------- New Message ---------------------------------- stream: throw ERR_INVALID_ARG_TYPE instead of ERR_INVALID_THIS
PR-URL: https://github.com/nodejs/node/pull/55153 Reviewed-By: Mattias Buelens <[email protected]> Reviewed-By: Matthew Aitken <[email protected]>
[detached HEAD 0413c2cc24] stream: throw ERR_INVALID_ARG_TYPE instead of ERR_INVALID_THIS Author: Nahee-Park <[email protected]> Date: Sun Sep 29 19:07:21 2024 +0900 1 file changed, 2 insertions(+), 1 deletion(-)
Successfully rebased and updated refs/heads/main.
βΉ Add
commit-queue-squashlabel to land the PR as one commit, orcommit-queue-rebaseto land as separate commits.
Landed in 3111ed7011e03eef7ccf7a27d0d7657e6a4e1cc4