From 2b391ea6226e4f039a1082b250d25a66bb0eb61e Mon Sep 17 00:00:00 2001 From: Kenneth Myhra Date: Wed, 15 Feb 2023 19:22:16 +0100 Subject: [PATCH] LibWeb: Make factory method of HTML::HTMLOptionsCollection fallible --- Userland/Libraries/LibWeb/HTML/HTMLOptionsCollection.cpp | 4 ++-- Userland/Libraries/LibWeb/HTML/HTMLOptionsCollection.h | 2 +- Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOptionsCollection.cpp b/Userland/Libraries/LibWeb/HTML/HTMLOptionsCollection.cpp index 65d3e80522..013a26ffa0 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLOptionsCollection.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLOptionsCollection.cpp @@ -13,9 +13,9 @@ namespace Web::HTML { -JS::NonnullGCPtr HTMLOptionsCollection::create(DOM::ParentNode& root, Function filter) +WebIDL::ExceptionOr> HTMLOptionsCollection::create(DOM::ParentNode& root, Function filter) { - return root.heap().allocate(root.realm(), root, move(filter)).release_allocated_value_but_fixme_should_propagate_errors(); + return MUST_OR_THROW_OOM(root.heap().allocate(root.realm(), root, move(filter))); } HTMLOptionsCollection::HTMLOptionsCollection(DOM::ParentNode& root, Function filter) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOptionsCollection.h b/Userland/Libraries/LibWeb/HTML/HTMLOptionsCollection.h index 46686fd223..da1bd85b64 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLOptionsCollection.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLOptionsCollection.h @@ -19,7 +19,7 @@ class HTMLOptionsCollection final : public DOM::HTMLCollection { WEB_PLATFORM_OBJECT(HTMLOptionsCollection, DOM::HTMLCollection); public: - static JS::NonnullGCPtr create(DOM::ParentNode& root, Function filter); + static WebIDL::ExceptionOr> create(DOM::ParentNode& root, Function filter); virtual ~HTMLOptionsCollection() override; WebIDL::ExceptionOr add(HTMLOptionOrOptGroupElement element, Optional before = {}); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp index f1fcbfcca8..0e87831a55 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp @@ -44,7 +44,7 @@ JS::GCPtr const& HTMLSelectElement::options() // the select element, and all the option element children of all the optgroup element children // of the select element, in tree order. return is(element); - }); + }).release_value_but_fixme_should_propagate_errors(); } return m_options; }