mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 14:47:46 +00:00
LibWeb: Implement a slightly better ad-hoc Body::clone method
Just creating a stream on the JS heap isn't enough, as we will later crash when trying to read from that stream as it hasn't been properly initialized. Instead, until we have teeing implemented (which is a rather huge part of the Streams spec), create streams using proper AOs that do initialize the stream.
This commit is contained in:
parent
c8c3866101
commit
9272d185ad
3 changed files with 34 additions and 2 deletions
|
@ -0,0 +1,17 @@
|
|||
<script src="../include.js"></script>
|
||||
<script>
|
||||
asyncTest(async done => {
|
||||
fetch("./../basic.html", { mode: "no-cors" })
|
||||
.then(response => {
|
||||
const clonedResponse = response.clone();
|
||||
return clonedResponse.body;
|
||||
})
|
||||
.then(body => {
|
||||
const reader = body.getReader();
|
||||
reader.read();
|
||||
|
||||
println("Was able to create a reader from a cloned Fetch response!");
|
||||
done();
|
||||
});
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue