From 491c18a346d6f60c6d2550c156f639b6e89932e1 Mon Sep 17 00:00:00 2001 From: Kenneth Myhra Date: Tue, 14 Feb 2023 20:43:19 +0100 Subject: [PATCH] LibWeb: Make factory method of DOM::DocumentFragment fallible --- Userland/Libraries/LibWeb/DOM/DocumentFragment.cpp | 4 ++-- Userland/Libraries/LibWeb/DOM/DocumentFragment.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Userland/Libraries/LibWeb/DOM/DocumentFragment.cpp b/Userland/Libraries/LibWeb/DOM/DocumentFragment.cpp index ff194862d7b..ed4c0169fff 100644 --- a/Userland/Libraries/LibWeb/DOM/DocumentFragment.cpp +++ b/Userland/Libraries/LibWeb/DOM/DocumentFragment.cpp @@ -34,10 +34,10 @@ void DocumentFragment::set_host(Web::DOM::Element* element) } // https://dom.spec.whatwg.org/#dom-documentfragment-documentfragment -JS::NonnullGCPtr DocumentFragment::construct_impl(JS::Realm& realm) +WebIDL::ExceptionOr> DocumentFragment::construct_impl(JS::Realm& realm) { auto& window = verify_cast(realm.global_object()); - return realm.heap().allocate(realm, window.associated_document()).release_allocated_value_but_fixme_should_propagate_errors(); + return MUST_OR_THROW_OOM(realm.heap().allocate(realm, window.associated_document())); } } diff --git a/Userland/Libraries/LibWeb/DOM/DocumentFragment.h b/Userland/Libraries/LibWeb/DOM/DocumentFragment.h index a73b91252c6..2fb4f1446fe 100644 --- a/Userland/Libraries/LibWeb/DOM/DocumentFragment.h +++ b/Userland/Libraries/LibWeb/DOM/DocumentFragment.h @@ -19,7 +19,7 @@ class DocumentFragment WEB_PLATFORM_OBJECT(DocumentFragment, ParentNode); public: - static JS::NonnullGCPtr construct_impl(JS::Realm& realm); + static WebIDL::ExceptionOr> construct_impl(JS::Realm& realm); virtual ~DocumentFragment() override = default;