1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 08:48:11 +00:00

LibWeb: Make factory method of DOM::NodeIterator fallible

This commit is contained in:
Kenneth Myhra 2023-02-15 07:30:10 +01:00 committed by Linus Groh
parent 0791195843
commit d94b59263e
3 changed files with 4 additions and 4 deletions

View file

@ -47,13 +47,13 @@ void NodeIterator::visit_edges(Cell::Visitor& visitor)
}
// https://dom.spec.whatwg.org/#dom-document-createnodeiterator
JS::NonnullGCPtr<NodeIterator> NodeIterator::create(Node& root, unsigned what_to_show, JS::GCPtr<NodeFilter> filter)
WebIDL::ExceptionOr<JS::NonnullGCPtr<NodeIterator>> NodeIterator::create(Node& root, unsigned what_to_show, JS::GCPtr<NodeFilter> filter)
{
// 1. Let iterator be a new NodeIterator object.
// 2. Set iterators root and iterators reference to root.
// 3. Set iterators pointer before reference to true.
auto& realm = root.realm();
auto iterator = realm.heap().allocate<NodeIterator>(realm, root).release_allocated_value_but_fixme_should_propagate_errors();
auto iterator = MUST_OR_THROW_OOM(realm.heap().allocate<NodeIterator>(realm, root));
// 4. Set iterators whatToShow to whatToShow.
iterator->m_what_to_show = what_to_show;