mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-08 17:19:13 +00:00
LibWeb: Move ad hoc CallbackType helper method to CallbackType header
Abstract operations of a stream does not seem like the correct home for this function.
This commit is contained in:
parent
93f258deb7
commit
99073c0561
Notes:
github-actions[bot]
2024-12-11 14:12:23 +00:00
Author: https://github.com/shannonbooth
Commit: 99073c0561
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2831
Reviewed-by: https://github.com/kennethmyhra ✅
Reviewed-by: https://github.com/trflynn89
7 changed files with 29 additions and 28 deletions
|
@ -5302,21 +5302,6 @@ WebIDL::ExceptionOr<JS::Value> structured_clone(JS::Realm& realm, JS::Value valu
|
|||
return TRY(HTML::structured_deserialize(vm, serialized, realm));
|
||||
}
|
||||
|
||||
// Non-standard function to aid in converting a user-provided function into a WebIDL::Callback. This is essentially
|
||||
// what the Bindings generator would do at compile time, but at runtime instead.
|
||||
JS::ThrowCompletionOr<GC::Root<WebIDL::CallbackType>> property_to_callback(JS::VM& vm, JS::Value value, JS::PropertyKey const& property_key, WebIDL::OperationReturnsPromise operation_returns_promise)
|
||||
{
|
||||
auto property = TRY(value.get(vm, property_key));
|
||||
|
||||
if (property.is_undefined())
|
||||
return GC::Root<WebIDL::CallbackType> {};
|
||||
|
||||
if (!property.is_function())
|
||||
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAFunction, property.to_string_without_side_effects());
|
||||
|
||||
return vm.heap().allocate<WebIDL::CallbackType>(property.as_object(), HTML::incumbent_realm(), operation_returns_promise);
|
||||
}
|
||||
|
||||
// https://streams.spec.whatwg.org/#set-up-readable-byte-stream-controller-from-underlying-source
|
||||
WebIDL::ExceptionOr<void> set_up_readable_byte_stream_controller_from_underlying_source(ReadableStream& stream, JS::Value underlying_source, UnderlyingSource const& underlying_source_dict, double high_water_mark)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue