mirror of
https://github.com/zebrajr/ladybird.git
synced 2025-12-06 00:19:53 +01: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
|
|
@ -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…
Reference in New Issue
Block a user