diff options
author | Timothy Flynn <trflynn89@pm.me> | 2023-01-28 12:33:35 -0500 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2023-01-29 00:02:45 +0000 |
commit | 2692db869963ed10947b05f13eade5fcbd5951dc (patch) | |
tree | ef12b9e76ff4edb64571819643a92d8e6c33a2fe /Userland/Libraries/LibWeb/UIEvents | |
parent | 1c1b902a6a0c1c7017fdc6d9748018317a554c9b (diff) | |
download | serenity-2692db869963ed10947b05f13eade5fcbd5951dc.zip |
LibJS+Everywhere: Allow Cell::initialize overrides to throw OOM errors
Note that as of this commit, there aren't any such throwers, and the
call site in Heap::allocate will drop exceptions on the floor. This
commit only serves to change the declaration of the overrides, make sure
they return an empty value, and to propagate OOM errors frm their base
initialize invocations.
Diffstat (limited to 'Userland/Libraries/LibWeb/UIEvents')
10 files changed, 25 insertions, 15 deletions
diff --git a/Userland/Libraries/LibWeb/UIEvents/FocusEvent.cpp b/Userland/Libraries/LibWeb/UIEvents/FocusEvent.cpp index 3799d472eb..10e05fb181 100644 --- a/Userland/Libraries/LibWeb/UIEvents/FocusEvent.cpp +++ b/Userland/Libraries/LibWeb/UIEvents/FocusEvent.cpp @@ -22,10 +22,12 @@ FocusEvent::FocusEvent(JS::Realm& realm, DeprecatedFlyString const& event_name, FocusEvent::~FocusEvent() = default; -void FocusEvent::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> FocusEvent::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::FocusEventPrototype>(realm, "FocusEvent")); + + return {}; } } diff --git a/Userland/Libraries/LibWeb/UIEvents/FocusEvent.h b/Userland/Libraries/LibWeb/UIEvents/FocusEvent.h index f11b84918b..1ef560ca9a 100644 --- a/Userland/Libraries/LibWeb/UIEvents/FocusEvent.h +++ b/Userland/Libraries/LibWeb/UIEvents/FocusEvent.h @@ -25,7 +25,7 @@ public: private: FocusEvent(JS::Realm&, DeprecatedFlyString const& event_name, FocusEventInit const&); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/UIEvents/KeyboardEvent.cpp b/Userland/Libraries/LibWeb/UIEvents/KeyboardEvent.cpp index 7bc89ddbb6..37b0f642cb 100644 --- a/Userland/Libraries/LibWeb/UIEvents/KeyboardEvent.cpp +++ b/Userland/Libraries/LibWeb/UIEvents/KeyboardEvent.cpp @@ -132,10 +132,12 @@ KeyboardEvent::KeyboardEvent(JS::Realm& realm, DeprecatedFlyString const& event_ KeyboardEvent::~KeyboardEvent() = default; -void KeyboardEvent::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> KeyboardEvent::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::KeyboardEventPrototype>(realm, "KeyboardEvent")); + + return {}; } } diff --git a/Userland/Libraries/LibWeb/UIEvents/KeyboardEvent.h b/Userland/Libraries/LibWeb/UIEvents/KeyboardEvent.h index 0ce603b9e5..6b355792a2 100644 --- a/Userland/Libraries/LibWeb/UIEvents/KeyboardEvent.h +++ b/Userland/Libraries/LibWeb/UIEvents/KeyboardEvent.h @@ -56,7 +56,7 @@ public: private: KeyboardEvent(JS::Realm&, DeprecatedFlyString const& event_name, KeyboardEventInit const& event_init); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; DeprecatedString m_key; DeprecatedString m_code; diff --git a/Userland/Libraries/LibWeb/UIEvents/MouseEvent.cpp b/Userland/Libraries/LibWeb/UIEvents/MouseEvent.cpp index 2c4138f4fd..0f9a593841 100644 --- a/Userland/Libraries/LibWeb/UIEvents/MouseEvent.cpp +++ b/Userland/Libraries/LibWeb/UIEvents/MouseEvent.cpp @@ -29,10 +29,12 @@ MouseEvent::MouseEvent(JS::Realm& realm, DeprecatedFlyString const& event_name, MouseEvent::~MouseEvent() = default; -void MouseEvent::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> MouseEvent::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::MouseEventPrototype>(realm, "MouseEvent")); + + return {}; } // https://www.w3.org/TR/uievents/#dom-mouseevent-button diff --git a/Userland/Libraries/LibWeb/UIEvents/MouseEvent.h b/Userland/Libraries/LibWeb/UIEvents/MouseEvent.h index 03d0f1b8bd..839e01a37b 100644 --- a/Userland/Libraries/LibWeb/UIEvents/MouseEvent.h +++ b/Userland/Libraries/LibWeb/UIEvents/MouseEvent.h @@ -58,7 +58,7 @@ public: protected: MouseEvent(JS::Realm&, DeprecatedFlyString const& event_name, MouseEventInit const& event_init); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; private: void set_event_characteristics(); diff --git a/Userland/Libraries/LibWeb/UIEvents/UIEvent.cpp b/Userland/Libraries/LibWeb/UIEvents/UIEvent.cpp index e5781a8422..06bbf93b0d 100644 --- a/Userland/Libraries/LibWeb/UIEvents/UIEvent.cpp +++ b/Userland/Libraries/LibWeb/UIEvents/UIEvent.cpp @@ -33,10 +33,12 @@ UIEvent::UIEvent(JS::Realm& realm, DeprecatedFlyString const& event_name, UIEven UIEvent::~UIEvent() = default; -void UIEvent::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> UIEvent::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::UIEventPrototype>(realm, "UIEvent")); + + return {}; } void UIEvent::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/UIEvents/UIEvent.h b/Userland/Libraries/LibWeb/UIEvents/UIEvent.h index 97e7b1cd84..cf7ff0c106 100644 --- a/Userland/Libraries/LibWeb/UIEvents/UIEvent.h +++ b/Userland/Libraries/LibWeb/UIEvents/UIEvent.h @@ -41,7 +41,7 @@ protected: UIEvent(JS::Realm&, DeprecatedFlyString const& event_name); UIEvent(JS::Realm&, DeprecatedFlyString const& event_name, UIEventInit const& event_init); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; JS::GCPtr<HTML::Window> m_view; diff --git a/Userland/Libraries/LibWeb/UIEvents/WheelEvent.cpp b/Userland/Libraries/LibWeb/UIEvents/WheelEvent.cpp index 46152ce8dd..5001070427 100644 --- a/Userland/Libraries/LibWeb/UIEvents/WheelEvent.cpp +++ b/Userland/Libraries/LibWeb/UIEvents/WheelEvent.cpp @@ -22,10 +22,12 @@ WheelEvent::WheelEvent(JS::Realm& realm, DeprecatedFlyString const& event_name, WheelEvent::~WheelEvent() = default; -void WheelEvent::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> WheelEvent::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::WheelEventPrototype>(realm, "WheelEvent")); + + return {}; } WheelEvent* WheelEvent::create(JS::Realm& realm, DeprecatedFlyString const& event_name, WheelEventInit const& event_init) diff --git a/Userland/Libraries/LibWeb/UIEvents/WheelEvent.h b/Userland/Libraries/LibWeb/UIEvents/WheelEvent.h index 43a3c80f61..30d62ff020 100644 --- a/Userland/Libraries/LibWeb/UIEvents/WheelEvent.h +++ b/Userland/Libraries/LibWeb/UIEvents/WheelEvent.h @@ -42,7 +42,7 @@ public: private: WheelEvent(JS::Realm&, DeprecatedFlyString const& event_name, WheelEventInit const& event_init); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; void set_event_characteristics(); |