From 5ef9e026584497a8438b5d3ad81269ee1ff64ec9 Mon Sep 17 00:00:00 2001 From: Kenneth Myhra Date: Tue, 14 Feb 2023 21:21:50 +0100 Subject: [PATCH] LibWeb: Make factory method of DOM::Comment fallible --- Userland/Libraries/LibWeb/DOM/Comment.cpp | 4 ++-- Userland/Libraries/LibWeb/DOM/Comment.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Userland/Libraries/LibWeb/DOM/Comment.cpp b/Userland/Libraries/LibWeb/DOM/Comment.cpp index e92cfe911a..cbd4ac1448 100644 --- a/Userland/Libraries/LibWeb/DOM/Comment.cpp +++ b/Userland/Libraries/LibWeb/DOM/Comment.cpp @@ -16,10 +16,10 @@ Comment::Comment(Document& document, DeprecatedString const& data) } // https://dom.spec.whatwg.org/#dom-comment-comment -JS::NonnullGCPtr Comment::construct_impl(JS::Realm& realm, DeprecatedString const& data) +WebIDL::ExceptionOr> Comment::construct_impl(JS::Realm& realm, DeprecatedString const& data) { auto& window = verify_cast(realm.global_object()); - return realm.heap().allocate(realm, window.associated_document(), data).release_allocated_value_but_fixme_should_propagate_errors(); + return MUST_OR_THROW_OOM(realm.heap().allocate(realm, window.associated_document(), data)); } } diff --git a/Userland/Libraries/LibWeb/DOM/Comment.h b/Userland/Libraries/LibWeb/DOM/Comment.h index 0192c4a8f2..0b509672c7 100644 --- a/Userland/Libraries/LibWeb/DOM/Comment.h +++ b/Userland/Libraries/LibWeb/DOM/Comment.h @@ -15,7 +15,7 @@ class Comment final : public CharacterData { WEB_PLATFORM_OBJECT(Comment, CharacterData); public: - static JS::NonnullGCPtr construct_impl(JS::Realm&, DeprecatedString const& data); + static WebIDL::ExceptionOr> construct_impl(JS::Realm&, DeprecatedString const& data); virtual ~Comment() override = default; virtual DeprecatedFlyString node_name() const override { return "#comment"; }