LibWeb: Make factory method of DOM::LiveNodeList fallible

This commit is contained in:
Kenneth Myhra 2023-02-14 22:55:51 +01:00 committed by Linus Groh
parent ff875d353b
commit 24d7e688fc
Notes: sideshowbarker 2024-07-17 00:12:21 +09:00
3 changed files with 4 additions and 4 deletions

View File

@ -10,9 +10,9 @@
namespace Web::DOM {
JS::NonnullGCPtr<NodeList> LiveNodeList::create(JS::Realm& realm, Node& root, Function<bool(Node const&)> filter)
WebIDL::ExceptionOr<JS::NonnullGCPtr<NodeList>> LiveNodeList::create(JS::Realm& realm, Node& root, Function<bool(Node const&)> filter)
{
return realm.heap().allocate<LiveNodeList>(realm, realm, root, move(filter)).release_allocated_value_but_fixme_should_propagate_errors();
return MUST_OR_THROW_OOM(realm.heap().allocate<LiveNodeList>(realm, realm, root, move(filter)));
}
LiveNodeList::LiveNodeList(JS::Realm& realm, Node& root, Function<bool(Node const&)> filter)

View File

@ -18,7 +18,7 @@ class LiveNodeList final : public NodeList {
WEB_PLATFORM_OBJECT(LiveNodeList, NodeList);
public:
static JS::NonnullGCPtr<NodeList> create(JS::Realm&, Node& root, Function<bool(Node const&)> filter);
static WebIDL::ExceptionOr<JS::NonnullGCPtr<NodeList>> create(JS::Realm&, Node& root, Function<bool(Node const&)> filter);
virtual ~LiveNodeList() override;
virtual u32 length() const override;

View File

@ -890,7 +890,7 @@ JS::NonnullGCPtr<NodeList> Node::child_nodes()
if (!m_child_nodes) {
m_child_nodes = LiveNodeList::create(realm(), *this, [this](auto& node) {
return is_parent_of(node);
});
}).release_value_but_fixme_should_propagate_errors();
}
return *m_child_nodes;
}