1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 10:07:44 +00:00

LibWeb: Make factory methods of DOM::CustomEvent fallible

This commit is contained in:
Kenneth Myhra 2023-02-14 21:27:42 +01:00 committed by Linus Groh
parent 5ef9e02658
commit 2c8a689390
3 changed files with 6 additions and 6 deletions

View file

@ -11,12 +11,12 @@
namespace Web::DOM { namespace Web::DOM {
CustomEvent* CustomEvent::create(JS::Realm& realm, DeprecatedFlyString const& event_name, CustomEventInit const& event_init) WebIDL::ExceptionOr<JS::NonnullGCPtr<CustomEvent>> CustomEvent::create(JS::Realm& realm, DeprecatedFlyString const& event_name, CustomEventInit const& event_init)
{ {
return realm.heap().allocate<CustomEvent>(realm, realm, event_name, event_init).release_allocated_value_but_fixme_should_propagate_errors(); return MUST_OR_THROW_OOM(realm.heap().allocate<CustomEvent>(realm, realm, event_name, event_init));
} }
CustomEvent* CustomEvent::construct_impl(JS::Realm& realm, DeprecatedFlyString const& event_name, CustomEventInit const& event_init) WebIDL::ExceptionOr<JS::NonnullGCPtr<CustomEvent>> CustomEvent::construct_impl(JS::Realm& realm, DeprecatedFlyString const& event_name, CustomEventInit const& event_init)
{ {
return create(realm, event_name, event_init); return create(realm, event_name, event_init);
} }

View file

@ -20,8 +20,8 @@ class CustomEvent : public Event {
WEB_PLATFORM_OBJECT(CustomEvent, Event); WEB_PLATFORM_OBJECT(CustomEvent, Event);
public: public:
static CustomEvent* create(JS::Realm&, DeprecatedFlyString const& event_name, CustomEventInit const& event_init = {}); static WebIDL::ExceptionOr<JS::NonnullGCPtr<CustomEvent>> create(JS::Realm&, DeprecatedFlyString const& event_name, CustomEventInit const& event_init = {});
static CustomEvent* construct_impl(JS::Realm&, DeprecatedFlyString const& event_name, CustomEventInit const& event_init); static WebIDL::ExceptionOr<JS::NonnullGCPtr<CustomEvent>> construct_impl(JS::Realm&, DeprecatedFlyString const& event_name, CustomEventInit const& event_init);
virtual ~CustomEvent() override; virtual ~CustomEvent() override;

View file

@ -1276,7 +1276,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Event>> Document::create_event(DeprecatedSt
} else if (interface_lowercase == "compositionevent") { } else if (interface_lowercase == "compositionevent") {
event = Event::create(realm, ""); // FIXME: Create CompositionEvent event = Event::create(realm, ""); // FIXME: Create CompositionEvent
} else if (interface_lowercase == "customevent") { } else if (interface_lowercase == "customevent") {
event = CustomEvent::create(realm, ""); event = TRY(CustomEvent::create(realm, ""));
} else if (interface_lowercase == "devicemotionevent") { } else if (interface_lowercase == "devicemotionevent") {
event = Event::create(realm, ""); // FIXME: Create DeviceMotionEvent event = Event::create(realm, ""); // FIXME: Create DeviceMotionEvent
} else if (interface_lowercase == "deviceorientationevent") { } else if (interface_lowercase == "deviceorientationevent") {