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

LibWeb: Make factory method of DOM::NamedNodeMap fallible

This commit is contained in:
Kenneth Myhra 2023-02-14 23:04:29 +01:00 committed by Linus Groh
parent ce18dfc417
commit e3e281addd
3 changed files with 7 additions and 4 deletions

View file

@ -8,6 +8,7 @@
#include <AK/Debug.h>
#include <AK/StringBuilder.h>
#include <LibWeb/Bindings/ElementPrototype.h>
#include <LibWeb/Bindings/ExceptionOrUtils.h>
#include <LibWeb/CSS/Parser/Parser.h>
#include <LibWeb/CSS/PropertyID.h>
#include <LibWeb/CSS/ResolvedCSSStyleDeclaration.h>
@ -66,7 +67,9 @@ JS::ThrowCompletionOr<void> Element::initialize(JS::Realm& realm)
MUST_OR_THROW_OOM(Base::initialize(realm));
set_prototype(&Bindings::ensure_web_prototype<Bindings::ElementPrototype>(realm, "Element"));
m_attributes = NamedNodeMap::create(*this);
m_attributes = TRY(Bindings::throw_dom_exception_if_needed(realm.vm(), [&]() {
return NamedNodeMap::create(*this);
}));
return {};
}