GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — stream: improve views validation on `BYOBRequest` · nodejs/node@96c3373

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib/internal/webstreams
    • readablestream.js
  • test/wpt/status
    • streams.json
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/internal/webstreams/readablestream.js‎

Copy file name to clipboardExpand all lines: lib/internal/webstreams/readablestream.js
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2516,6 +2516,15 @@ function readableByteStreamControllerRespondWithNewView(controller, view) {
25162516
const viewBuffer = ArrayBufferViewGetBuffer(view);
25172517
const viewBufferByteLength = ArrayBufferGetByteLength(viewBuffer);
25182518

2519+
if (stream[kState].state === 'closed') {
2520+
if (viewByteLength !== 0)
2521+
throw new ERR_INVALID_STATE.TypeError('View is not zero-length');
2522+
} else {
2523+
assert(stream[kState].state === 'readable');
2524+
if (viewByteLength === 0)
2525+
throw new ERR_INVALID_STATE.TypeError('View is zero-length');
2526+
}
2527+
25192528
const {
25202529
byteOffset,
25212530
byteLength,
Collapse file

‎test/wpt/status/streams.json‎

Copy file name to clipboardExpand all lines: test/wpt/status/streams.json
-8Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,5 @@
44
},
55
"transferable/deserialize-error.window.js": {
66
"skip": "Browser-specific test"
7-
},
8-
"readable-byte-streams/bad-buffers-and-views.any.js": {
9-
"fail": {
10-
"note": "TODO: implement detached ArrayBuffer support",
11-
"expected": [
12-
"ReadableStream with byte source: respondWithNewView() throws if the supplied view's buffer is zero-length (in the readable state)"
13-
]
14-
}
157
}
168
}

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.