mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-06 17:11:51 +00:00
LibWeb: Implement WritableStream transfer
This commit is contained in:
parent
312db85a84
commit
cca08ad833
Notes:
github-actions[bot]
2025-05-21 10:55:54 +00:00
Author: https://github.com/trflynn89
Commit: cca08ad833
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4828
Reviewed-by: https://github.com/shannonbooth ✅
6 changed files with 260 additions and 26 deletions
|
@ -50,6 +50,7 @@
|
|||
#include <LibWeb/HTML/MessagePort.h>
|
||||
#include <LibWeb/HTML/StructuredSerialize.h>
|
||||
#include <LibWeb/Streams/ReadableStream.h>
|
||||
#include <LibWeb/Streams/WritableStream.h>
|
||||
#include <LibWeb/WebIDL/DOMException.h>
|
||||
#include <LibWeb/WebIDL/ExceptionOr.h>
|
||||
|
||||
|
@ -1296,6 +1297,8 @@ static bool is_interface_exposed_on_target_realm(TransferType name, JS::Realm& r
|
|||
return intrinsics.is_exposed("MessagePort"sv);
|
||||
case TransferType::ReadableStream:
|
||||
return intrinsics.is_exposed("ReadableStream"sv);
|
||||
case TransferType::WritableStream:
|
||||
return intrinsics.is_exposed("WritableStream"sv);
|
||||
case TransferType::Unknown:
|
||||
dbgln("Unknown interface type for transfer: {}", to_underlying(name));
|
||||
break;
|
||||
|
@ -1318,6 +1321,11 @@ static WebIDL::ExceptionOr<GC::Ref<Bindings::PlatformObject>> create_transferred
|
|||
TRY(readable_stream->transfer_receiving_steps(transfer_data_holder));
|
||||
return readable_stream;
|
||||
}
|
||||
case TransferType::WritableStream: {
|
||||
auto writable_stream = target_realm.create<Streams::WritableStream>(target_realm);
|
||||
TRY(writable_stream->transfer_receiving_steps(transfer_data_holder));
|
||||
return writable_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