mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-30 19:47:17 +02:00
LibWeb: Use the proper in-flight request to check if a stream is closing
This commit is contained in:
committed by
Alexander Kalenik
parent
59cd086199
commit
b6501adef8
Notes:
sideshowbarker
2024-07-17 01:11:48 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/b6501adef8 Pull-request: https://github.com/SerenityOS/serenity/pull/23795 Reviewed-by: https://github.com/kalenikaliaksandr Reviewed-by: https://github.com/kennethmyhra ✅
28
Tests/LibWeb/Text/input/Streams/WritableStream-write.html
Normal file
28
Tests/LibWeb/Text/input/Streams/WritableStream-write.html
Normal file
@@ -0,0 +1,28 @@
|
||||
<script src="../include.js"></script>
|
||||
<script>
|
||||
asyncTest(done => {
|
||||
const stream = new WritableStream({
|
||||
write(chunk) {
|
||||
return new Promise(resolve => {
|
||||
println(chunk);
|
||||
resolve();
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
function sendMessage(message) {
|
||||
const writer = stream.getWriter();
|
||||
|
||||
for (const chunk of message) {
|
||||
writer.ready.then(() => writer.write(chunk));
|
||||
}
|
||||
|
||||
writer.ready.then(() => {
|
||||
writer.close();
|
||||
done();
|
||||
});
|
||||
}
|
||||
|
||||
sendMessage("Well-hello-friends!");
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user