Skip to content

Commit

Permalink
Bug 1595736 [wpt PR 20205] - Verify piping disturbs stream synchronou…
Browse files Browse the repository at this point in the history
…sly, a=testonly

Automatic update from web-platform-tests
Verify piping disturbs stream synchronously (#20205)

whatwg/streams#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
  • Loading branch information
ricea authored and moz-wptsync-bot committed Nov 29, 2019
1 parent 94ff766 commit 7836b9c
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
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');

0 comments on commit 7836b9c

Please sign in to comment.