mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:07:46 +00:00
LibWeb: Make factory method of DOM::LiveNodeList fallible
This commit is contained in:
parent
ff875d353b
commit
24d7e688fc
3 changed files with 4 additions and 4 deletions
|
@ -10,9 +10,9 @@
|
||||||
|
|
||||||
namespace Web::DOM {
|
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)
|
LiveNodeList::LiveNodeList(JS::Realm& realm, Node& root, Function<bool(Node const&)> filter)
|
||||||
|
|
|
@ -18,7 +18,7 @@ class LiveNodeList final : public NodeList {
|
||||||
WEB_PLATFORM_OBJECT(LiveNodeList, NodeList);
|
WEB_PLATFORM_OBJECT(LiveNodeList, NodeList);
|
||||||
|
|
||||||
public:
|
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 ~LiveNodeList() override;
|
||||||
|
|
||||||
virtual u32 length() const override;
|
virtual u32 length() const override;
|
||||||
|
|
|
@ -890,7 +890,7 @@ JS::NonnullGCPtr<NodeList> Node::child_nodes()
|
||||||
if (!m_child_nodes) {
|
if (!m_child_nodes) {
|
||||||
m_child_nodes = LiveNodeList::create(realm(), *this, [this](auto& node) {
|
m_child_nodes = LiveNodeList::create(realm(), *this, [this](auto& node) {
|
||||||
return is_parent_of(node);
|
return is_parent_of(node);
|
||||||
});
|
}).release_value_but_fixme_should_propagate_errors();
|
||||||
}
|
}
|
||||||
return *m_child_nodes;
|
return *m_child_nodes;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue