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

LibWeb: Make factory methods of CSS::CSSRuleList fallible

This commit is contained in:
Kenneth Myhra 2023-02-12 23:03:41 +01:00 committed by Linus Groh
parent 5601f439f9
commit 48872cd190
3 changed files with 16 additions and 14 deletions

View file

@ -17,9 +17,9 @@
namespace Web::CSS {
CSSRuleList* CSSRuleList::create(JS::Realm& realm, JS::MarkedVector<CSSRule*> const& rules)
WebIDL::ExceptionOr<JS::NonnullGCPtr<CSSRuleList>> CSSRuleList::create(JS::Realm& realm, JS::MarkedVector<CSSRule*> const& rules)
{
auto rule_list = realm.heap().allocate<CSSRuleList>(realm, realm).release_allocated_value_but_fixme_should_propagate_errors();
auto rule_list = MUST_OR_THROW_OOM(realm.heap().allocate<CSSRuleList>(realm, realm));
for (auto* rule : rules)
rule_list->m_rules.append(*rule);
return rule_list;
@ -30,9 +30,9 @@ CSSRuleList::CSSRuleList(JS::Realm& realm)
{
}
CSSRuleList* CSSRuleList::create_empty(JS::Realm& realm)
WebIDL::ExceptionOr<JS::NonnullGCPtr<CSSRuleList>> CSSRuleList::create_empty(JS::Realm& realm)
{
return realm.heap().allocate<CSSRuleList>(realm, realm).release_allocated_value_but_fixme_should_propagate_errors();
return MUST_OR_THROW_OOM(realm.heap().allocate<CSSRuleList>(realm, realm));
}
JS::ThrowCompletionOr<void> CSSRuleList::initialize(JS::Realm& realm)