diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp index e28131e2c5..0afe2b1391 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.cpp +++ b/Userland/Libraries/LibWeb/DOM/Document.cpp @@ -1024,7 +1024,7 @@ JS::NonnullGCPtr Document::get_elements_by_name(DeprecatedString { return HTMLCollection::create(*this, [name](Element const& element) { return element.name() == name; - }); + }).release_value_but_fixme_should_propagate_errors(); } JS::NonnullGCPtr Document::get_elements_by_class_name(DeprecatedFlyString const& class_names) @@ -1039,14 +1039,14 @@ JS::NonnullGCPtr Document::get_elements_by_class_name(Deprecated return false; } return true; - }); + }).release_value_but_fixme_should_propagate_errors(); } // https://html.spec.whatwg.org/multipage/obsolete.html#dom-document-applets JS::NonnullGCPtr Document::applets() { if (!m_applets) - m_applets = HTMLCollection::create(*this, [](auto&) { return false; }); + m_applets = HTMLCollection::create(*this, [](auto&) { return false; }).release_value_but_fixme_should_propagate_errors(); return *m_applets; } @@ -1056,7 +1056,7 @@ JS::NonnullGCPtr Document::anchors() if (!m_anchors) { m_anchors = HTMLCollection::create(*this, [](Element const& element) { return is(element) && element.has_attribute(HTML::AttributeNames::name); - }); + }).release_value_but_fixme_should_propagate_errors(); } return *m_anchors; } @@ -1067,7 +1067,7 @@ JS::NonnullGCPtr Document::images() if (!m_images) { m_images = HTMLCollection::create(*this, [](Element const& element) { return is(element); - }); + }).release_value_but_fixme_should_propagate_errors(); } return *m_images; } @@ -1078,7 +1078,7 @@ JS::NonnullGCPtr Document::embeds() if (!m_embeds) { m_embeds = HTMLCollection::create(*this, [](Element const& element) { return is(element); - }); + }).release_value_but_fixme_should_propagate_errors(); } return *m_embeds; } @@ -1095,7 +1095,7 @@ JS::NonnullGCPtr Document::links() if (!m_links) { m_links = HTMLCollection::create(*this, [](Element const& element) { return (is(element) || is(element)) && element.has_attribute(HTML::AttributeNames::href); - }); + }).release_value_but_fixme_should_propagate_errors(); } return *m_links; } @@ -1106,7 +1106,7 @@ JS::NonnullGCPtr Document::forms() if (!m_forms) { m_forms = HTMLCollection::create(*this, [](Element const& element) { return is(element); - }); + }).release_value_but_fixme_should_propagate_errors(); } return *m_forms; } @@ -1117,7 +1117,7 @@ JS::NonnullGCPtr Document::scripts() if (!m_scripts) { m_scripts = HTMLCollection::create(*this, [](Element const& element) { return is(element); - }); + }).release_value_but_fixme_should_propagate_errors(); } return *m_scripts; } @@ -1128,7 +1128,7 @@ JS::NonnullGCPtr Document::all() if (!m_all) { m_all = HTMLCollection::create(*this, [](Element const&) { return true; - }); + }).release_value_but_fixme_should_propagate_errors(); } return *m_all; } @@ -2004,7 +2004,7 @@ void Document::check_favicon_after_loading_link_resource() return false; return static_cast(element).has_loaded_icon(); - }); + }).release_value_but_fixme_should_propagate_errors(); if (favicon_link_elements->length() == 0) { dbgln_if(SPAM_DEBUG, "No favicon found to be used"); diff --git a/Userland/Libraries/LibWeb/DOM/Element.cpp b/Userland/Libraries/LibWeb/DOM/Element.cpp index 69f1eabcb8..5a6ab10e52 100644 --- a/Userland/Libraries/LibWeb/DOM/Element.cpp +++ b/Userland/Libraries/LibWeb/DOM/Element.cpp @@ -586,7 +586,7 @@ JS::NonnullGCPtr Element::get_elements_by_class_name(DeprecatedF return false; } return true; - }); + }).release_value_but_fixme_should_propagate_errors(); } // https://dom.spec.whatwg.org/#element-shadow-host diff --git a/Userland/Libraries/LibWeb/DOM/HTMLCollection.cpp b/Userland/Libraries/LibWeb/DOM/HTMLCollection.cpp index 2849e7ac40..45e1b1a4d4 100644 --- a/Userland/Libraries/LibWeb/DOM/HTMLCollection.cpp +++ b/Userland/Libraries/LibWeb/DOM/HTMLCollection.cpp @@ -13,9 +13,9 @@ namespace Web::DOM { -JS::NonnullGCPtr HTMLCollection::create(ParentNode& root, Function filter) +WebIDL::ExceptionOr> HTMLCollection::create(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))); } HTMLCollection::HTMLCollection(ParentNode& root, Function filter) diff --git a/Userland/Libraries/LibWeb/DOM/HTMLCollection.h b/Userland/Libraries/LibWeb/DOM/HTMLCollection.h index 78998f2f4b..8e99f64bf6 100644 --- a/Userland/Libraries/LibWeb/DOM/HTMLCollection.h +++ b/Userland/Libraries/LibWeb/DOM/HTMLCollection.h @@ -29,7 +29,7 @@ class HTMLCollection : public Bindings::LegacyPlatformObject { WEB_PLATFORM_OBJECT(HTMLCollection, Bindings::LegacyPlatformObject); public: - static JS::NonnullGCPtr create(ParentNode& root, Function filter); + static WebIDL::ExceptionOr> create(ParentNode& root, Function filter); virtual ~HTMLCollection() override; diff --git a/Userland/Libraries/LibWeb/DOM/ParentNode.cpp b/Userland/Libraries/LibWeb/DOM/ParentNode.cpp index 8654ac6526..0cce06ddd6 100644 --- a/Userland/Libraries/LibWeb/DOM/ParentNode.cpp +++ b/Userland/Libraries/LibWeb/DOM/ParentNode.cpp @@ -96,7 +96,7 @@ JS::NonnullGCPtr ParentNode::children() if (!m_children) { m_children = HTMLCollection::create(*this, [this](Element const& element) { return is_parent_of(element); - }); + }).release_value_but_fixme_should_propagate_errors(); } return *m_children; } @@ -109,7 +109,7 @@ JS::NonnullGCPtr ParentNode::get_elements_by_tag_name(Deprecated if (qualified_name == "*") { return HTMLCollection::create(*this, [](Element const&) { return true; - }); + }).release_value_but_fixme_should_propagate_errors(); } // 2. Otherwise, if root’s node document is an HTML document, return a HTMLCollection rooted at root, whose filter matches the following descendant elements: @@ -121,13 +121,13 @@ JS::NonnullGCPtr ParentNode::get_elements_by_tag_name(Deprecated // - Whose namespace is not the HTML namespace and whose qualified name is qualifiedName. return element.qualified_name() == qualified_name; - }); + }).release_value_but_fixme_should_propagate_errors(); } // 3. Otherwise, return a HTMLCollection rooted at root, whose filter matches descendant elements whose qualified name is qualifiedName. return HTMLCollection::create(*this, [qualified_name](Element const& element) { return element.qualified_name() == qualified_name; - }); + }).release_value_but_fixme_should_propagate_errors(); } // https://dom.spec.whatwg.org/#concept-getelementsbytagnamens @@ -143,27 +143,27 @@ JS::NonnullGCPtr ParentNode::get_elements_by_tag_name_ns(Depreca if (namespace_ == "*" && local_name == "*") { return HTMLCollection::create(*this, [](Element const&) { return true; - }); + }).release_value_but_fixme_should_propagate_errors(); } // 3. Otherwise, if namespace is "*" (U+002A), return a HTMLCollection rooted at root, whose filter matches descendant elements whose local name is localName. if (namespace_ == "*") { return HTMLCollection::create(*this, [local_name](Element const& element) { return element.local_name() == local_name; - }); + }).release_value_but_fixme_should_propagate_errors(); } // 4. Otherwise, if localName is "*" (U+002A), return a HTMLCollection rooted at root, whose filter matches descendant elements whose namespace is namespace. if (local_name == "*") { return HTMLCollection::create(*this, [namespace_](Element const& element) { return element.namespace_() == namespace_; - }); + }).release_value_but_fixme_should_propagate_errors(); } // 5. Otherwise, return a HTMLCollection rooted at root, whose filter matches descendant elements whose namespace is namespace and local name is localName. return HTMLCollection::create(*this, [namespace_, local_name](Element const& element) { return element.namespace_() == namespace_ && element.local_name() == local_name; - }); + }).release_value_but_fixme_should_propagate_errors(); } // https://dom.spec.whatwg.org/#dom-parentnode-prepend diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp index c5a1a65a7d..7aa01d7aed 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp @@ -236,7 +236,7 @@ JS::NonnullGCPtr HTMLFormElement::elements() const if (!m_elements) { m_elements = DOM::HTMLCollection::create(const_cast(*this), [](Element const& element) { return is_form_control(element); - }); + }).release_value_but_fixme_should_propagate_errors(); } return *m_elements; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTableElement.cpp index a6747dcd13..322c5cff4e 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableElement.cpp @@ -264,7 +264,7 @@ JS::NonnullGCPtr HTMLTableElement::t_bodies() if (!m_t_bodies) { m_t_bodies = DOM::HTMLCollection::create(*this, [](DOM::Element const& element) { return element.local_name() == TagNames::tbody; - }); + }).release_value_but_fixme_should_propagate_errors(); } return *m_t_bodies; } @@ -321,7 +321,7 @@ JS::NonnullGCPtr HTMLTableElement::rows() } return false; - }); + }).release_value_but_fixme_should_propagate_errors(); } return *m_rows; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.cpp index db02190d93..a72941ee6b 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.cpp @@ -45,7 +45,7 @@ JS::NonnullGCPtr HTMLTableRowElement::cells() const m_cells = DOM::HTMLCollection::create(const_cast(*this), [this](Element const& element) { return element.parent() == this && is(element); - }); + }).release_value_but_fixme_should_propagate_errors(); } return *m_cells; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableSectionElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTableSectionElement.cpp index 5c469839c3..1f4b976526 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableSectionElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableSectionElement.cpp @@ -44,7 +44,7 @@ JS::NonnullGCPtr HTMLTableSectionElement::rows() const m_rows = DOM::HTMLCollection::create(const_cast(*this), [this](Element const& element) { return element.parent() == this && is(element); - }); + }).release_value_but_fixme_should_propagate_errors(); } return *m_rows; }