mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-23 17:52:26 -05:00
WebContent: Convert ConsoleGlobalObject functions to ThrowCompletionOr
This commit is contained in:
parent
10b93506ad
commit
9d1fb85f93
Notes:
sideshowbarker
2024-07-18 01:40:44 +09:00
Author: https://github.com/IdanHo Commit: https://github.com/SerenityOS/serenity/commit/9d1fb85f939 Pull-request: https://github.com/SerenityOS/serenity/pull/10728
2 changed files with 6 additions and 8 deletions
|
@ -28,7 +28,7 @@ void ConsoleGlobalObject::initialize_global_object()
|
|||
Base::initialize_global_object();
|
||||
|
||||
// $0 magic variable
|
||||
define_old_native_accessor("$0", inspected_node_getter, nullptr, 0);
|
||||
define_native_accessor("$0", inspected_node_getter, nullptr, 0);
|
||||
}
|
||||
|
||||
void ConsoleGlobalObject::visit_edges(Visitor& visitor)
|
||||
|
@ -98,14 +98,12 @@ JS::ThrowCompletionOr<JS::MarkedValueList> ConsoleGlobalObject::internal_own_pro
|
|||
return m_window_object->internal_own_property_keys();
|
||||
}
|
||||
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ConsoleGlobalObject::inspected_node_getter)
|
||||
JS_DEFINE_NATIVE_FUNCTION(ConsoleGlobalObject::inspected_node_getter)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(vm.this_value(global_object).to_object(global_object));
|
||||
auto* this_object = TRY(vm.this_value(global_object).to_object(global_object));
|
||||
|
||||
if (!is<ConsoleGlobalObject>(this_object)) {
|
||||
vm.throw_exception<JS::TypeError>(global_object, JS::ErrorType::NotAnObjectOfType, "ConsoleGlobalObject");
|
||||
return {};
|
||||
}
|
||||
if (!is<ConsoleGlobalObject>(this_object))
|
||||
return vm.throw_completion<JS::TypeError>(global_object, JS::ErrorType::NotAnObjectOfType, "ConsoleGlobalObject");
|
||||
|
||||
auto console_global_object = static_cast<ConsoleGlobalObject*>(this_object);
|
||||
auto& window = console_global_object->m_window_object->impl();
|
||||
|
|
|
@ -41,7 +41,7 @@ private:
|
|||
virtual void visit_edges(Visitor&) override;
|
||||
|
||||
// Because $0 is not a nice C++ function name
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(inspected_node_getter);
|
||||
JS_DECLARE_NATIVE_FUNCTION(inspected_node_getter);
|
||||
|
||||
Web::Bindings::WindowObject* m_window_object;
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue