mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-20 11:36:10 +00:00
LibWeb: Release acquired readers after piping through a stream
This very partially implements the spec's "finalize" steps for piping streams.
This commit is contained in:
parent
383d303b79
commit
4b4b12165e
Notes:
github-actions[bot]
2024-12-10 03:04:00 +00:00
Author: https://github.com/gmta Commit: https://github.com/LadybirdBrowser/ladybird/commit/4b4b12165e9 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2162 Reviewed-by: https://github.com/ADKaster ✅ Reviewed-by: https://github.com/shannonbooth
1 changed files with 4 additions and 2 deletions
|
@ -315,16 +315,18 @@ GC::Ref<WebIDL::Promise> readable_stream_pipe_to(ReadableStream& source, Writabl
|
|||
WebIDL::resolve_promise(realm, promise, JS::js_undefined());
|
||||
});
|
||||
|
||||
auto success_steps = GC::create_function(realm.heap(), [promise, &realm, writer](ByteBuffer) {
|
||||
auto success_steps = GC::create_function(realm.heap(), [promise, &realm, reader, writer](ByteBuffer) {
|
||||
// Make sure we close the acquired writer.
|
||||
WebIDL::resolve_promise(realm, writable_stream_default_writer_close(*writer), JS::js_undefined());
|
||||
readable_stream_default_reader_release(*reader);
|
||||
|
||||
WebIDL::resolve_promise(realm, promise, JS::js_undefined());
|
||||
});
|
||||
|
||||
auto failure_steps = GC::create_function(realm.heap(), [promise, &realm, writer](JS::Value error) {
|
||||
auto failure_steps = GC::create_function(realm.heap(), [promise, &realm, reader, writer](JS::Value error) {
|
||||
// Make sure we close the acquired writer.
|
||||
WebIDL::resolve_promise(realm, writable_stream_default_writer_close(*writer), JS::js_undefined());
|
||||
readable_stream_default_reader_release(*reader);
|
||||
|
||||
WebIDL::reject_promise(realm, promise, error);
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue