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/URL | |
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/URL')
-rw-r--r-- | Userland/Libraries/LibWeb/URL/URL.cpp | 6 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/URL/URL.h | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/URL/URLSearchParams.cpp | 6 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/URL/URLSearchParams.h | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/URL/URLSearchParamsIterator.cpp | 6 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/URL/URLSearchParamsIterator.h | 2 |
6 files changed, 15 insertions, 9 deletions
diff --git a/Userland/Libraries/LibWeb/URL/URL.cpp b/Userland/Libraries/LibWeb/URL/URL.cpp index 49cfc3f906..5aefd55fa3 100644 --- a/Userland/Libraries/LibWeb/URL/URL.cpp +++ b/Userland/Libraries/LibWeb/URL/URL.cpp @@ -61,10 +61,12 @@ URL::URL(JS::Realm& realm, AK::URL url, JS::NonnullGCPtr<URLSearchParams> query) URL::~URL() = default; -void URL::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> URL::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::URLPrototype>(realm, "URL")); + + return {}; } void URL::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/URL/URL.h b/Userland/Libraries/LibWeb/URL/URL.h index d691f0ec08..389241b24b 100644 --- a/Userland/Libraries/LibWeb/URL/URL.h +++ b/Userland/Libraries/LibWeb/URL/URL.h @@ -65,7 +65,7 @@ public: private: URL(JS::Realm&, AK::URL, JS::NonnullGCPtr<URLSearchParams> query); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; AK::URL m_url; diff --git a/Userland/Libraries/LibWeb/URL/URLSearchParams.cpp b/Userland/Libraries/LibWeb/URL/URLSearchParams.cpp index ddf08690a6..c31e068ae5 100644 --- a/Userland/Libraries/LibWeb/URL/URLSearchParams.cpp +++ b/Userland/Libraries/LibWeb/URL/URLSearchParams.cpp @@ -21,10 +21,12 @@ URLSearchParams::URLSearchParams(JS::Realm& realm, Vector<QueryParam> list) URLSearchParams::~URLSearchParams() = default; -void URLSearchParams::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> URLSearchParams::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::URLSearchParamsPrototype>(realm, "URLSearchParams")); + + return {}; } void URLSearchParams::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/URL/URLSearchParams.h b/Userland/Libraries/LibWeb/URL/URLSearchParams.h index 9456c83030..afe56d02d4 100644 --- a/Userland/Libraries/LibWeb/URL/URLSearchParams.h +++ b/Userland/Libraries/LibWeb/URL/URLSearchParams.h @@ -48,7 +48,7 @@ private: URLSearchParams(JS::Realm&, Vector<QueryParam> list); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; void update(); diff --git a/Userland/Libraries/LibWeb/URL/URLSearchParamsIterator.cpp b/Userland/Libraries/LibWeb/URL/URLSearchParamsIterator.cpp index 66ebc57ee9..2ac44893fe 100644 --- a/Userland/Libraries/LibWeb/URL/URLSearchParamsIterator.cpp +++ b/Userland/Libraries/LibWeb/URL/URLSearchParamsIterator.cpp @@ -37,10 +37,12 @@ URLSearchParamsIterator::URLSearchParamsIterator(URLSearchParams const& url_sear URLSearchParamsIterator::~URLSearchParamsIterator() = default; -void URLSearchParamsIterator::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> URLSearchParamsIterator::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::URLSearchParamsIteratorPrototype>(realm, "URLSearchParamsIterator")); + + return {}; } void URLSearchParamsIterator::visit_edges(JS::Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/URL/URLSearchParamsIterator.h b/Userland/Libraries/LibWeb/URL/URLSearchParamsIterator.h index 7a2714d22a..324c55253b 100644 --- a/Userland/Libraries/LibWeb/URL/URLSearchParamsIterator.h +++ b/Userland/Libraries/LibWeb/URL/URLSearchParamsIterator.h @@ -24,7 +24,7 @@ public: private: URLSearchParamsIterator(URLSearchParams const&, JS::Object::PropertyKind iteration_kind); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; URLSearchParams const& m_url_search_params; |