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

Commit 2004d21

Browse files
MattiasBuelensmoz-wptsync-bot
authored andcommitted
Bug 1721499 [wpt PR 29723] - Streams: add tests for ReadableStreamBYOBReader.read(view, { min }), a=testonly
Automatic update from web-platform-tests Streams: add tests for ReadableStreamBYOBReader read(view, { min }) Follows whatwg/streams#1145. -- wpt-commits: 7eaf605c38d80377c717828376deabad86b702b2 wpt-pr: 29723
1 parent 7c1c678 commit 2004d21

File tree

4 files changed

+790
-50
lines changed

4 files changed

+790
-50
lines changed

testing/web-platform/tests/streams/piping/general.any.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// META: global=window,worker,shadowrealm
2-
// META: script=../resources/test-utils.js
32
// META: script=../resources/recording-streams.js
43
'use strict';
54

@@ -39,7 +38,8 @@ promise_test(t => {
3938
const fakeRS = Object.create(ReadableStream.prototype);
4039
const ws = new WritableStream();
4140

42-
return methodRejects(t, ReadableStream.prototype, 'pipeTo', fakeRS, [ws]);
41+
return promise_rejects_js(t, TypeError, ReadableStream.prototype.pipeTo.apply(fakeRS, [ws]),
42+
'pipeTo should reject with a TypeError');
4343

4444
}, 'pipeTo must check the brand of its ReadableStream this value');
4545

@@ -48,7 +48,8 @@ promise_test(t => {
4848
const rs = new ReadableStream();
4949
const fakeWS = Object.create(WritableStream.prototype);
5050

51-
return methodRejects(t, ReadableStream.prototype, 'pipeTo', rs, [fakeWS]);
51+
return promise_rejects_js(t, TypeError, ReadableStream.prototype.pipeTo.apply(rs, [fakeWS]),
52+
'pipeTo should reject with a TypeError');
5253

5354
}, 'pipeTo must check the brand of its WritableStream argument');
5455

testing/web-platform/tests/streams/readable-byte-streams/non-transferable-buffers.any.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,18 @@ promise_test(async t => {
1313
await promise_rejects_js(t, TypeError, reader.read(view));
1414
}, 'ReadableStream with byte source: read() with a non-transferable buffer');
1515

16+
promise_test(async t => {
17+
const rs = new ReadableStream({
18+
pull: t.unreached_func('pull() should not be called'),
19+
type: 'bytes'
20+
});
21+
22+
const reader = rs.getReader({ mode: 'byob' });
23+
const memory = new WebAssembly.Memory({ initial: 1 });
24+
const view = new Uint8Array(memory.buffer, 0, 1);
25+
await promise_rejects_js(t, TypeError, reader.fill(view));
26+
}, 'ReadableStream with byte source: fill() with a non-transferable buffer');
27+
1628
test(t => {
1729
let controller;
1830
const rs = new ReadableStream({

0 commit comments

Comments
 (0)