mirror of
https://github.com/RGBCube/serenity
synced 2025-05-17 19:05:07 +00:00
LibWeb: Port call_user_object_operation from DeprecatedString
This commit is contained in:
parent
6813dcaff8
commit
a7b8828db2
5 changed files with 7 additions and 7 deletions
|
@ -113,7 +113,7 @@ bool EventDispatcher::inner_invoke(Event& event, Vector<JS::Handle<DOM::DOMEvent
|
||||||
// FIXME: These should be wrapped for us in call_user_object_operation, but it currently doesn't do that.
|
// FIXME: These should be wrapped for us in call_user_object_operation, but it currently doesn't do that.
|
||||||
auto* this_value = event.current_target().ptr();
|
auto* this_value = event.current_target().ptr();
|
||||||
auto* wrapped_event = &event;
|
auto* wrapped_event = &event;
|
||||||
auto result = WebIDL::call_user_object_operation(callback, "handleEvent", this_value, wrapped_event);
|
auto result = WebIDL::call_user_object_operation(callback, "handleEvent"_string, this_value, wrapped_event);
|
||||||
|
|
||||||
// If this throws an exception, then:
|
// If this throws an exception, then:
|
||||||
if (result.is_error()) {
|
if (result.is_error()) {
|
||||||
|
|
|
@ -159,7 +159,7 @@ JS::ThrowCompletionOr<NodeFilter::Result> NodeIterator::filter(Node& node)
|
||||||
|
|
||||||
// 6. Let result be the return value of call a user object’s operation with traverser’s filter, "acceptNode", and « node ».
|
// 6. Let result be the return value of call a user object’s operation with traverser’s filter, "acceptNode", and « node ».
|
||||||
// If this throws an exception, then unset traverser’s active flag and rethrow the exception.
|
// If this throws an exception, then unset traverser’s active flag and rethrow the exception.
|
||||||
auto result = WebIDL::call_user_object_operation(m_filter->callback(), "acceptNode", {}, &node);
|
auto result = WebIDL::call_user_object_operation(m_filter->callback(), "acceptNode"_string, {}, &node);
|
||||||
if (result.is_abrupt()) {
|
if (result.is_abrupt()) {
|
||||||
m_active = false;
|
m_active = false;
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -257,7 +257,7 @@ JS::ThrowCompletionOr<NodeFilter::Result> TreeWalker::filter(Node& node)
|
||||||
|
|
||||||
// 6. Let result be the return value of call a user object’s operation with traverser’s filter, "acceptNode", and « node ».
|
// 6. Let result be the return value of call a user object’s operation with traverser’s filter, "acceptNode", and « node ».
|
||||||
// If this throws an exception, then unset traverser’s active flag and rethrow the exception.
|
// If this throws an exception, then unset traverser’s active flag and rethrow the exception.
|
||||||
auto result = WebIDL::call_user_object_operation(m_filter->callback(), "acceptNode", {}, &node);
|
auto result = WebIDL::call_user_object_operation(m_filter->callback(), "acceptNode"_string, {}, &node);
|
||||||
if (result.is_abrupt()) {
|
if (result.is_abrupt()) {
|
||||||
m_active = false;
|
m_active = false;
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -114,7 +114,7 @@ inline JS::Completion clean_up_on_return(HTML::EnvironmentSettingsObject& stored
|
||||||
return JS::Value { rejected_promise->promise() };
|
return JS::Value { rejected_promise->promise() };
|
||||||
}
|
}
|
||||||
|
|
||||||
JS::Completion call_user_object_operation(WebIDL::CallbackType& callback, DeprecatedString const& operation_name, Optional<JS::Value> this_argument, JS::MarkedVector<JS::Value> args)
|
JS::Completion call_user_object_operation(WebIDL::CallbackType& callback, String const& operation_name, Optional<JS::Value> this_argument, JS::MarkedVector<JS::Value> args)
|
||||||
{
|
{
|
||||||
// 1. Let completion be an uninitialized variable.
|
// 1. Let completion be an uninitialized variable.
|
||||||
JS::Completion completion;
|
JS::Completion completion;
|
||||||
|
@ -147,7 +147,7 @@ JS::Completion call_user_object_operation(WebIDL::CallbackType& callback, Deprec
|
||||||
// 10. If ! IsCallable(O) is false, then:
|
// 10. If ! IsCallable(O) is false, then:
|
||||||
if (!object->is_function()) {
|
if (!object->is_function()) {
|
||||||
// 1. Let getResult be Get(O, opName).
|
// 1. Let getResult be Get(O, opName).
|
||||||
auto get_result = object->get(operation_name);
|
auto get_result = object->get(operation_name.to_deprecated_string());
|
||||||
|
|
||||||
// 2. If getResult is an abrupt completion, set completion to getResult and jump to the step labeled return.
|
// 2. If getResult is an abrupt completion, set completion to getResult and jump to the step labeled return.
|
||||||
if (get_result.is_throw_completion()) {
|
if (get_result.is_throw_completion()) {
|
||||||
|
|
|
@ -19,11 +19,11 @@ namespace Web::WebIDL {
|
||||||
|
|
||||||
ErrorOr<ByteBuffer> get_buffer_source_copy(JS::Object const& buffer_source);
|
ErrorOr<ByteBuffer> get_buffer_source_copy(JS::Object const& buffer_source);
|
||||||
|
|
||||||
JS::Completion call_user_object_operation(WebIDL::CallbackType& callback, DeprecatedString const& operation_name, Optional<JS::Value> this_argument, JS::MarkedVector<JS::Value> args);
|
JS::Completion call_user_object_operation(WebIDL::CallbackType& callback, String const& operation_name, Optional<JS::Value> this_argument, JS::MarkedVector<JS::Value> args);
|
||||||
|
|
||||||
// https://webidl.spec.whatwg.org/#call-a-user-objects-operation
|
// https://webidl.spec.whatwg.org/#call-a-user-objects-operation
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
JS::Completion call_user_object_operation(WebIDL::CallbackType& callback, DeprecatedString const& operation_name, Optional<JS::Value> this_argument, Args&&... args)
|
JS::Completion call_user_object_operation(WebIDL::CallbackType& callback, String const& operation_name, Optional<JS::Value> this_argument, Args&&... args)
|
||||||
{
|
{
|
||||||
auto& function_object = callback.callback;
|
auto& function_object = callback.callback;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue