mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-11 05:39:41 +02:00
Automatic update from web-platform-tests Verify piping disturbs stream synchronously (#20205) https://github.com/whatwg/streams/pull/1022 changes pipeTo and pipeThrough to always set the [[disturbed]] slot of the Response's body to true synchronously. This test verifies that behaviour. -- wpt-commits: 760485a4f652813d1f195ee28042c391cf2fdc02 wpt-pr: 20205
15 lines
635 B
JavaScript
15 lines
635 B
JavaScript
test(() => {
|
|
const r = new Response(new ReadableStream());
|
|
// highWaterMark: 0 means that nothing will actually be read from the body.
|
|
r.body.pipeTo(new WritableStream({}, {highWaterMark: 0}));
|
|
assert_true(r.bodyUsed, 'bodyUsed should be true');
|
|
}, 'using pipeTo on Response body should disturb it synchronously');
|
|
|
|
test(() => {
|
|
const r = new Response(new ReadableStream());
|
|
r.body.pipeThrough({
|
|
writable: new WritableStream({}, {highWaterMark: 0}),
|
|
readable: new ReadableStream()
|
|
});
|
|
assert_true(r.bodyUsed, 'bodyUsed should be true');
|
|
}, 'using pipeThrough on Response body should disturb it synchronously');
|