1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:37:37 +00:00

LibWeb: Make factory method of DOM::TreeWalker fallible

This commit is contained in:
Kenneth Myhra 2023-02-14 21:41:47 +01:00 committed by Linus Groh
parent 251c063897
commit 552663a2ba
3 changed files with 4 additions and 4 deletions

View file

@ -39,12 +39,12 @@ void TreeWalker::visit_edges(Cell::Visitor& visitor)
}
// https://dom.spec.whatwg.org/#dom-document-createtreewalker
JS::NonnullGCPtr<TreeWalker> TreeWalker::create(Node& root, unsigned what_to_show, JS::GCPtr<NodeFilter> filter)
WebIDL::ExceptionOr<JS::NonnullGCPtr<TreeWalker>> TreeWalker::create(Node& root, unsigned what_to_show, JS::GCPtr<NodeFilter> filter)
{
// 1. Let walker be a new TreeWalker object.
// 2. Set walkers root and walkers current to root.
auto& realm = root.realm();
auto walker = realm.heap().allocate<TreeWalker>(realm, root).release_allocated_value_but_fixme_should_propagate_errors();
auto walker = MUST_OR_THROW_OOM(realm.heap().allocate<TreeWalker>(realm, root));
// 3. Set walkers whatToShow to whatToShow.
walker->m_what_to_show = what_to_show;