Tests/LibWeb: Verify we throw when trying to pipe from/to locked streams

This commit is contained in:
Kenneth Myhra 2024-04-06 19:56:55 +02:00 committed by Andreas Kling
commit a0802b6e29
Notes: sideshowbarker 2024-07-17 05:05:51 +09:00
4 changed files with 46 additions and 0 deletions

View file

@ -0,0 +1 @@
TypeError: Failed to execute 'pipeTo' on 'ReadableStream': Cannot pipe a locked stream

View file

@ -0,0 +1 @@
TypeError: Failed to execute 'pipeTo' on 'ReadableStream': Cannot pipe to a locked stream

View file

@ -0,0 +1,22 @@
<script src="../include.js"></script>
<script>
asyncTest(done => {
const writableStream = new WritableStream(
{
write(chunk) {}
}
);
const stream = new ReadableStream({
start(controller) {},
pull(controller) {},
cancel() {},
});
stream.getReader();
stream.pipeTo(writableStream)
.catch(reason => {
println(reason);
done();
});
});
</script>

View file

@ -0,0 +1,22 @@
<script src="../include.js"></script>
<script>
asyncTest(done => {
const writableStream = new WritableStream(
{
write(chunk) {}
}
);
const stream = new ReadableStream({
start(controller) {},
pull(controller) {},
cancel() {},
});
writableStream.getWriter();
stream.pipeTo(writableStream)
.catch(reason => {
println(reason);
done();
});
});
</script>