mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:47:34 +00:00
LibWeb: Make factory method of HTML::CloseEvent fallible
This commit is contained in:
parent
b7c488e51e
commit
2ed7f64c73
3 changed files with 6 additions and 6 deletions
|
@ -9,12 +9,12 @@
|
|||
|
||||
namespace Web::HTML {
|
||||
|
||||
CloseEvent* CloseEvent::create(JS::Realm& realm, DeprecatedFlyString const& event_name, CloseEventInit const& event_init)
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<CloseEvent>> CloseEvent::create(JS::Realm& realm, DeprecatedFlyString const& event_name, CloseEventInit const& event_init)
|
||||
{
|
||||
return realm.heap().allocate<CloseEvent>(realm, realm, event_name, event_init).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
return MUST_OR_THROW_OOM(realm.heap().allocate<CloseEvent>(realm, realm, event_name, event_init));
|
||||
}
|
||||
|
||||
CloseEvent* CloseEvent::construct_impl(JS::Realm& realm, DeprecatedFlyString const& event_name, CloseEventInit const& event_init)
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<CloseEvent>> CloseEvent::construct_impl(JS::Realm& realm, DeprecatedFlyString const& event_name, CloseEventInit const& event_init)
|
||||
{
|
||||
return create(realm, event_name, event_init);
|
||||
}
|
||||
|
|
|
@ -21,8 +21,8 @@ class CloseEvent : public DOM::Event {
|
|||
WEB_PLATFORM_OBJECT(CloseEvent, DOM::Event);
|
||||
|
||||
public:
|
||||
static CloseEvent* create(JS::Realm&, DeprecatedFlyString const& event_name, CloseEventInit const& event_init = {});
|
||||
static CloseEvent* construct_impl(JS::Realm&, DeprecatedFlyString const& event_name, CloseEventInit const& event_init);
|
||||
static WebIDL::ExceptionOr<JS::NonnullGCPtr<CloseEvent>> create(JS::Realm&, DeprecatedFlyString const& event_name, CloseEventInit const& event_init = {});
|
||||
static WebIDL::ExceptionOr<JS::NonnullGCPtr<CloseEvent>> construct_impl(JS::Realm&, DeprecatedFlyString const& event_name, CloseEventInit const& event_init);
|
||||
|
||||
virtual ~CloseEvent() override;
|
||||
|
||||
|
|
|
@ -222,7 +222,7 @@ void WebSocket::on_close(u16 code, DeprecatedString reason, bool was_clean)
|
|||
event_init.was_clean = was_clean;
|
||||
event_init.code = code;
|
||||
event_init.reason = move(reason);
|
||||
dispatch_event(*HTML::CloseEvent::create(realm(), HTML::EventNames::close, event_init));
|
||||
dispatch_event(HTML::CloseEvent::create(realm(), HTML::EventNames::close, event_init).release_value_but_fixme_should_propagate_errors());
|
||||
}
|
||||
|
||||
// https://websockets.spec.whatwg.org/#feedback-from-the-protocol
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue