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/Geometry | |
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/Geometry')
10 files changed, 25 insertions, 15 deletions
diff --git a/Userland/Libraries/LibWeb/Geometry/DOMPoint.cpp b/Userland/Libraries/LibWeb/Geometry/DOMPoint.cpp index cd2a160629..20a091c77e 100644 --- a/Userland/Libraries/LibWeb/Geometry/DOMPoint.cpp +++ b/Userland/Libraries/LibWeb/Geometry/DOMPoint.cpp @@ -29,10 +29,12 @@ JS::NonnullGCPtr<DOMPoint> DOMPoint::from_point(JS::VM& vm, DOMPointInit const& DOMPoint::~DOMPoint() = default; -void DOMPoint::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> DOMPoint::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::DOMPointPrototype>(realm, "DOMPoint")); + + return {}; } } diff --git a/Userland/Libraries/LibWeb/Geometry/DOMPoint.h b/Userland/Libraries/LibWeb/Geometry/DOMPoint.h index 8d9bdc4c9e..57999c4402 100644 --- a/Userland/Libraries/LibWeb/Geometry/DOMPoint.h +++ b/Userland/Libraries/LibWeb/Geometry/DOMPoint.h @@ -35,7 +35,7 @@ public: private: DOMPoint(JS::Realm&, double x, double y, double z, double w); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/Geometry/DOMPointReadOnly.cpp b/Userland/Libraries/LibWeb/Geometry/DOMPointReadOnly.cpp index 0b43b00f38..bbef19a0dd 100644 --- a/Userland/Libraries/LibWeb/Geometry/DOMPointReadOnly.cpp +++ b/Userland/Libraries/LibWeb/Geometry/DOMPointReadOnly.cpp @@ -33,10 +33,12 @@ JS::NonnullGCPtr<DOMPointReadOnly> DOMPointReadOnly::from_point(JS::VM& vm, DOMP DOMPointReadOnly::~DOMPointReadOnly() = default; -void DOMPointReadOnly::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> DOMPointReadOnly::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::DOMPointReadOnlyPrototype>(realm, "DOMPointReadOnly")); + + return {}; } } diff --git a/Userland/Libraries/LibWeb/Geometry/DOMPointReadOnly.h b/Userland/Libraries/LibWeb/Geometry/DOMPointReadOnly.h index be5819b57f..c52bc75bee 100644 --- a/Userland/Libraries/LibWeb/Geometry/DOMPointReadOnly.h +++ b/Userland/Libraries/LibWeb/Geometry/DOMPointReadOnly.h @@ -39,7 +39,7 @@ public: protected: DOMPointReadOnly(JS::Realm&, double x, double y, double z, double w); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; double m_x; double m_y; diff --git a/Userland/Libraries/LibWeb/Geometry/DOMRect.cpp b/Userland/Libraries/LibWeb/Geometry/DOMRect.cpp index f74c4c74f3..54415fa7f0 100644 --- a/Userland/Libraries/LibWeb/Geometry/DOMRect.cpp +++ b/Userland/Libraries/LibWeb/Geometry/DOMRect.cpp @@ -26,10 +26,12 @@ DOMRect::DOMRect(JS::Realm& realm, double x, double y, double width, double heig DOMRect::~DOMRect() = default; -void DOMRect::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> DOMRect::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::DOMRectPrototype>(realm, "DOMRect")); + + return {}; } } diff --git a/Userland/Libraries/LibWeb/Geometry/DOMRect.h b/Userland/Libraries/LibWeb/Geometry/DOMRect.h index b8398102d8..0eb93c1d54 100644 --- a/Userland/Libraries/LibWeb/Geometry/DOMRect.h +++ b/Userland/Libraries/LibWeb/Geometry/DOMRect.h @@ -33,7 +33,7 @@ public: private: DOMRect(JS::Realm&, double x, double y, double width, double height); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/Geometry/DOMRectList.cpp b/Userland/Libraries/LibWeb/Geometry/DOMRectList.cpp index ece3ce8a06..14e5bc4e57 100644 --- a/Userland/Libraries/LibWeb/Geometry/DOMRectList.cpp +++ b/Userland/Libraries/LibWeb/Geometry/DOMRectList.cpp @@ -27,10 +27,12 @@ DOMRectList::DOMRectList(JS::Realm& realm, Vector<JS::NonnullGCPtr<DOMRect>> rec DOMRectList::~DOMRectList() = default; -void DOMRectList::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> DOMRectList::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::DOMRectListPrototype>(realm, "DOMRectList")); + + return {}; } // https://drafts.fxtf.org/geometry-1/#dom-domrectlist-length diff --git a/Userland/Libraries/LibWeb/Geometry/DOMRectList.h b/Userland/Libraries/LibWeb/Geometry/DOMRectList.h index cc98b0e284..cf43ff88c0 100644 --- a/Userland/Libraries/LibWeb/Geometry/DOMRectList.h +++ b/Userland/Libraries/LibWeb/Geometry/DOMRectList.h @@ -30,7 +30,7 @@ public: private: DOMRectList(JS::Realm&, Vector<JS::NonnullGCPtr<DOMRect>>); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; Vector<JS::NonnullGCPtr<DOMRect>> m_rects; }; diff --git a/Userland/Libraries/LibWeb/Geometry/DOMRectReadOnly.cpp b/Userland/Libraries/LibWeb/Geometry/DOMRectReadOnly.cpp index c6a3286aef..a583d500fc 100644 --- a/Userland/Libraries/LibWeb/Geometry/DOMRectReadOnly.cpp +++ b/Userland/Libraries/LibWeb/Geometry/DOMRectReadOnly.cpp @@ -22,10 +22,12 @@ DOMRectReadOnly::DOMRectReadOnly(JS::Realm& realm, double x, double y, double wi DOMRectReadOnly::~DOMRectReadOnly() = default; -void DOMRectReadOnly::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> DOMRectReadOnly::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::DOMRectReadOnlyPrototype>(realm, "DOMRectReadOnly")); + + return {}; } } diff --git a/Userland/Libraries/LibWeb/Geometry/DOMRectReadOnly.h b/Userland/Libraries/LibWeb/Geometry/DOMRectReadOnly.h index f0abdf72c5..0fd39aa462 100644 --- a/Userland/Libraries/LibWeb/Geometry/DOMRectReadOnly.h +++ b/Userland/Libraries/LibWeb/Geometry/DOMRectReadOnly.h @@ -34,7 +34,7 @@ public: protected: DOMRectReadOnly(JS::Realm&, double x, double y, double width, double height); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; Gfx::FloatRect m_rect; }; |