mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-20 17:58:18 +03:00
LibWeb: Make factory method of DOM::LiveNodeList fallible
This commit is contained in:
parent
ff875d353b
commit
24d7e688fc
Notes:
sideshowbarker
2024-07-17 00:12:21 +09:00
Author: https://github.com/kennethmyhra Commit: https://github.com/SerenityOS/serenity/commit/24d7e688fc Pull-request: https://github.com/SerenityOS/serenity/pull/17491 Reviewed-by: https://github.com/linusg ✅
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user