mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:57:35 +00:00
LibWeb: Make factory method of HTML::PromiseRejectionEvent fallible
This commit is contained in:
parent
193de231e0
commit
3941e64fde
4 changed files with 8 additions and 8 deletions
|
@ -138,8 +138,8 @@ JS::VM& main_thread_vm()
|
||||||
/* .promise = */ promise,
|
/* .promise = */ promise,
|
||||||
/* .reason = */ promise.result(),
|
/* .reason = */ promise.result(),
|
||||||
};
|
};
|
||||||
auto promise_rejection_event = HTML::PromiseRejectionEvent::create(HTML::relevant_realm(global), HTML::EventNames::rejectionhandled, event_init);
|
auto promise_rejection_event = HTML::PromiseRejectionEvent::create(HTML::relevant_realm(global), HTML::EventNames::rejectionhandled, event_init).release_value_but_fixme_should_propagate_errors();
|
||||||
window.dispatch_event(*promise_rejection_event);
|
window.dispatch_event(promise_rejection_event);
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,12 +9,12 @@
|
||||||
|
|
||||||
namespace Web::HTML {
|
namespace Web::HTML {
|
||||||
|
|
||||||
PromiseRejectionEvent* PromiseRejectionEvent::create(JS::Realm& realm, DeprecatedFlyString const& event_name, PromiseRejectionEventInit const& event_init)
|
WebIDL::ExceptionOr<JS::NonnullGCPtr<PromiseRejectionEvent>> PromiseRejectionEvent::create(JS::Realm& realm, DeprecatedFlyString const& event_name, PromiseRejectionEventInit const& event_init)
|
||||||
{
|
{
|
||||||
return realm.heap().allocate<PromiseRejectionEvent>(realm, realm, event_name, event_init).release_allocated_value_but_fixme_should_propagate_errors();
|
return MUST_OR_THROW_OOM(realm.heap().allocate<PromiseRejectionEvent>(realm, realm, event_name, event_init));
|
||||||
}
|
}
|
||||||
|
|
||||||
PromiseRejectionEvent* PromiseRejectionEvent::construct_impl(JS::Realm& realm, DeprecatedFlyString const& event_name, PromiseRejectionEventInit const& event_init)
|
WebIDL::ExceptionOr<JS::NonnullGCPtr<PromiseRejectionEvent>> PromiseRejectionEvent::construct_impl(JS::Realm& realm, DeprecatedFlyString const& event_name, PromiseRejectionEventInit const& event_init)
|
||||||
{
|
{
|
||||||
return create(realm, event_name, event_init);
|
return create(realm, event_name, event_init);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,8 +23,8 @@ class PromiseRejectionEvent final : public DOM::Event {
|
||||||
WEB_PLATFORM_OBJECT(PromiseRejectionEvent, DOM::Event);
|
WEB_PLATFORM_OBJECT(PromiseRejectionEvent, DOM::Event);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static PromiseRejectionEvent* create(JS::Realm&, DeprecatedFlyString const& event_name, PromiseRejectionEventInit const& event_init = {});
|
static WebIDL::ExceptionOr<JS::NonnullGCPtr<PromiseRejectionEvent>> create(JS::Realm&, DeprecatedFlyString const& event_name, PromiseRejectionEventInit const& event_init = {});
|
||||||
static PromiseRejectionEvent* construct_impl(JS::Realm&, DeprecatedFlyString const& event_name, PromiseRejectionEventInit const& event_init);
|
static WebIDL::ExceptionOr<JS::NonnullGCPtr<PromiseRejectionEvent>> construct_impl(JS::Realm&, DeprecatedFlyString const& event_name, PromiseRejectionEventInit const& event_init);
|
||||||
|
|
||||||
virtual ~PromiseRejectionEvent() override;
|
virtual ~PromiseRejectionEvent() override;
|
||||||
|
|
||||||
|
|
|
@ -251,7 +251,7 @@ void EnvironmentSettingsObject::notify_about_rejected_promises(Badge<EventLoop>)
|
||||||
// FIXME: This currently assumes that global is a WindowObject.
|
// FIXME: This currently assumes that global is a WindowObject.
|
||||||
auto& window = verify_cast<HTML::Window>(global);
|
auto& window = verify_cast<HTML::Window>(global);
|
||||||
|
|
||||||
auto promise_rejection_event = PromiseRejectionEvent::create(window.realm(), HTML::EventNames::unhandledrejection, event_init);
|
auto promise_rejection_event = PromiseRejectionEvent::create(window.realm(), HTML::EventNames::unhandledrejection, event_init).release_value_but_fixme_should_propagate_errors();
|
||||||
|
|
||||||
bool not_handled = window.dispatch_event(*promise_rejection_event);
|
bool not_handled = window.dispatch_event(*promise_rejection_event);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue