Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit 6fc4942

Browse files
MattiasBuelensmoz-wptsync-bot
authored andcommitted
Bug 1746096 [wpt PR 32072] - Streams: reject pending reads when releasing reader, a=testonly
Automatic update from web-platform-tests Streams: reject pending reads when releasing reader Follows whatwg/streams#1168. -- wpt-commits: 99d74f9529e16ec0722ef11136ab29b9e80fff26 wpt-pr: 32072
1 parent b702568 commit 6fc4942

File tree

6 files changed

+578
-45
lines changed

6 files changed

+578
-45
lines changed

testing/web-platform/tests/streams/readable-byte-streams/bad-buffers-and-views.any.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,38 @@ async_test(t => {
203203
}, 'ReadableStream with byte source: respondWithNewView() throws if the supplied view is zero-length on a ' +
204204
'non-zero-length buffer (in the readable state)');
205205

206+
async_test(t => {
207+
const stream = new ReadableStream({
208+
pull: t.step_func_done(c => {
209+
const view = c.byobRequest.view.subarray(1, 2);
210+
211+
assert_throws_js(RangeError, () => c.byobRequest.respondWithNewView(view));
212+
}),
213+
type: 'bytes'
214+
});
215+
const reader = stream.getReader({ mode: 'byob' });
216+
217+
reader.read(new Uint8Array([4, 5, 6]));
218+
}, 'ReadableStream with byte source: respondWithNewView() throws if the supplied view has a different offset ' +
219+
'(in the readable state)');
220+
221+
async_test(t => {
222+
const stream = new ReadableStream({
223+
pull: t.step_func_done(c => {
224+
c.close();
225+
226+
const view = c.byobRequest.view.subarray(1, 1);
227+
228+
assert_throws_js(RangeError, () => c.byobRequest.respondWithNewView(view));
229+
}),
230+
type: 'bytes'
231+
});
232+
const reader = stream.getReader({ mode: 'byob' });
233+
234+
reader.read(new Uint8Array([4, 5, 6]));
235+
}, 'ReadableStream with byte source: respondWithNewView() throws if the supplied view has a different offset ' +
236+
'(in the closed state)');
237+
206238
async_test(t => {
207239
const stream = new ReadableStream({
208240
pull: t.step_func_done(c => {

0 commit comments

Comments
 (0)