diff --git a/Userland/Libraries/LibWeb/DOM/DOMTokenList.cpp b/Userland/Libraries/LibWeb/DOM/DOMTokenList.cpp index ff519dafeb5..aad7f31c787 100644 --- a/Userland/Libraries/LibWeb/DOM/DOMTokenList.cpp +++ b/Userland/Libraries/LibWeb/DOM/DOMTokenList.cpp @@ -52,10 +52,10 @@ inline void replace_in_ordered_set(Vector& set, StringView ite namespace Web::DOM { -DOMTokenList* DOMTokenList::create(Element const& associated_element, DeprecatedFlyString associated_attribute) +WebIDL::ExceptionOr> DOMTokenList::create(Element const& associated_element, DeprecatedFlyString associated_attribute) { auto& realm = associated_element.realm(); - return realm.heap().allocate(realm, associated_element, move(associated_attribute)).release_allocated_value_but_fixme_should_propagate_errors(); + return MUST_OR_THROW_OOM(realm.heap().allocate(realm, associated_element, move(associated_attribute))); } // https://dom.spec.whatwg.org/#ref-for-domtokenlist%E2%91%A0%E2%91%A2 diff --git a/Userland/Libraries/LibWeb/DOM/DOMTokenList.h b/Userland/Libraries/LibWeb/DOM/DOMTokenList.h index 60dda71782c..79b2daac1ff 100644 --- a/Userland/Libraries/LibWeb/DOM/DOMTokenList.h +++ b/Userland/Libraries/LibWeb/DOM/DOMTokenList.h @@ -23,7 +23,7 @@ class DOMTokenList final : public Bindings::LegacyPlatformObject { WEB_PLATFORM_OBJECT(DOMTokenList, Bindings::LegacyPlatformObject); public: - static DOMTokenList* create(Element const& associated_element, DeprecatedFlyString associated_attribute); + static WebIDL::ExceptionOr> create(Element const& associated_element, DeprecatedFlyString associated_attribute); ~DOMTokenList() = default; void associated_attribute_changed(StringView value); diff --git a/Userland/Libraries/LibWeb/DOM/Element.cpp b/Userland/Libraries/LibWeb/DOM/Element.cpp index 614b4af169a..69f1eabcb87 100644 --- a/Userland/Libraries/LibWeb/DOM/Element.cpp +++ b/Userland/Libraries/LibWeb/DOM/Element.cpp @@ -455,7 +455,7 @@ NonnullRefPtr Element::resolved_css_values() DOMTokenList* Element::class_list() { if (!m_class_list) - m_class_list = DOMTokenList::create(*this, HTML::AttributeNames::class_); + m_class_list = DOMTokenList::create(*this, HTML::AttributeNames::class_).release_value_but_fixme_should_propagate_errors(); return m_class_list; }