mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-06 17:11:51 +00:00
LibWeb: Implement ReadableStream transfer
This commit is contained in:
parent
7e225b496d
commit
312db85a84
Notes:
github-actions[bot]
2025-05-21 10:56:01 +00:00
Author: https://github.com/trflynn89
Commit: 312db85a84
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4828
Reviewed-by: https://github.com/shannonbooth ✅
9 changed files with 511 additions and 28 deletions
|
@ -49,6 +49,7 @@
|
|||
#include <LibWeb/HTML/ImageData.h>
|
||||
#include <LibWeb/HTML/MessagePort.h>
|
||||
#include <LibWeb/HTML/StructuredSerialize.h>
|
||||
#include <LibWeb/Streams/ReadableStream.h>
|
||||
#include <LibWeb/WebIDL/DOMException.h>
|
||||
#include <LibWeb/WebIDL/ExceptionOr.h>
|
||||
|
||||
|
@ -1293,7 +1294,8 @@ static bool is_interface_exposed_on_target_realm(TransferType name, JS::Realm& r
|
|||
switch (name) {
|
||||
case TransferType::MessagePort:
|
||||
return intrinsics.is_exposed("MessagePort"sv);
|
||||
break;
|
||||
case TransferType::ReadableStream:
|
||||
return intrinsics.is_exposed("ReadableStream"sv);
|
||||
case TransferType::Unknown:
|
||||
dbgln("Unknown interface type for transfer: {}", to_underlying(name));
|
||||
break;
|
||||
|
@ -1311,6 +1313,11 @@ static WebIDL::ExceptionOr<GC::Ref<Bindings::PlatformObject>> create_transferred
|
|||
TRY(message_port->transfer_receiving_steps(transfer_data_holder));
|
||||
return message_port;
|
||||
}
|
||||
case TransferType::ReadableStream: {
|
||||
auto readable_stream = target_realm.create<Streams::ReadableStream>(target_realm);
|
||||
TRY(readable_stream->transfer_receiving_steps(transfer_data_holder));
|
||||
return readable_stream;
|
||||
}
|
||||
case TransferType::ArrayBuffer:
|
||||
case TransferType::ResizableArrayBuffer:
|
||||
dbgln("ArrayBuffer ({}) is not a platform object.", to_underlying(name));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue