mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-30 20:59:16 +00:00
LibWeb: Provide an UInt8Array to AO writable_stream_default_writer_write
ReadLoopReadRequest::on_chunk expects an UInt8Array, so make sure we convert the passed in ByteBuffer to an UInt8Array before passing it to the AO writable_stream_default_writer_write. Co-authored-by: Timothy Flynn <trflynn89@pm.me>
This commit is contained in:
parent
b5ba60f1d1
commit
15b677385c
Notes:
sideshowbarker
2024-07-17 10:16:43 +09:00
Author: https://github.com/kennethmyhra
Commit: 15b677385c
Pull-request: https://github.com/SerenityOS/serenity/pull/24132
Reviewed-by: https://github.com/shannonbooth
Reviewed-by: https://github.com/trflynn89
1 changed files with 5 additions and 3 deletions
|
@ -306,9 +306,11 @@ JS::NonnullGCPtr<WebIDL::Promise> readable_stream_pipe_to(ReadableStream& source
|
|||
|
||||
// FIXME: Currently a naive implementation that uses ReadableStreamDefaultReader::read_all_chunks() to read all chunks
|
||||
// from the source and then through the callback success_steps writes those chunks to the destination.
|
||||
auto chunk_steps = [&realm, writer](ByteBuffer chunk) {
|
||||
auto buffer = JS::ArrayBuffer::create(realm, move(chunk));
|
||||
auto promise = writable_stream_default_writer_write(writer, JS::Value { buffer });
|
||||
auto chunk_steps = [&realm, writer](ByteBuffer buffer) {
|
||||
auto array_buffer = JS::ArrayBuffer::create(realm, move(buffer));
|
||||
auto chunk = JS::Uint8Array::create(realm, array_buffer->byte_length(), *array_buffer);
|
||||
|
||||
auto promise = writable_stream_default_writer_write(writer, chunk);
|
||||
WebIDL::resolve_promise(realm, promise, JS::js_undefined());
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue