1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:07:35 +00:00

LibJS+LibWeb: Wrap raw JS::Cell*/& fields in GCPtr/NonnullGCPtr

This commit is contained in:
Matthew Olsson 2023-02-26 16:09:02 -07:00 committed by Andreas Kling
parent 1df3652e27
commit 7c0c1c8f49
214 changed files with 825 additions and 827 deletions

View file

@ -464,12 +464,12 @@ WebIDL::CallbackType* EventTarget::get_current_value_of_event_handler(Deprecated
function->set_script_or_module({});
// 12. Set eventHandler's value to the result of creating a Web IDL EventHandler callback function object whose object reference is function and whose callback context is settings object.
event_handler->value = realm.heap().allocate_without_realm<WebIDL::CallbackType>(*function, settings_object).ptr();
event_handler->value = JS::GCPtr(realm.heap().allocate_without_realm<WebIDL::CallbackType>(*function, settings_object));
}
// 4. Return eventHandler's value.
VERIFY(event_handler->value.has<WebIDL::CallbackType*>());
return *event_handler->value.get_pointer<WebIDL::CallbackType*>();
VERIFY(event_handler->value.has<JS::GCPtr<WebIDL::CallbackType>>());
return *event_handler->value.get_pointer<JS::GCPtr<WebIDL::CallbackType>>();
}
// https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-attributes:event-handler-idl-attributes-3
@ -512,7 +512,7 @@ void EventTarget::set_event_handler_attribute(DeprecatedFlyString const& name, W
auto& event_handler = event_handler_iterator->value;
event_handler->value = value;
event_handler->value = JS::GCPtr(value);
// 4. Activate an event handler given eventTarget and name.
// NOTE: See the optimization comment above.