WebContent: Convert ConsoleGlobalObject functions to ThrowCompletionOr

This commit is contained in:
Idan Horowitz 2021-10-31 17:05:46 +02:00
parent 10b93506ad
commit 9d1fb85f93
Notes: sideshowbarker 2024-07-18 01:40:44 +09:00
2 changed files with 6 additions and 8 deletions

View file

@ -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();

View file

@ -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;
};