summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/Encoding
diff options
context:
space:
mode:
authorKenneth Myhra <kennethmyhra@gmail.com>2023-02-19 16:53:44 +0100
committerAndreas Kling <kling@serenityos.org>2023-02-22 09:55:33 +0100
commitd7446089aeeec98548eaff942ac2ce22720003db (patch)
treed5ee99e6a77696d4fc532bae1ac39e2f4fdafb54 /Userland/Libraries/LibWeb/Encoding
parent77e44323678a6828526c44c3712fb6d096b1e535 (diff)
downloadserenity-d7446089aeeec98548eaff942ac2ce22720003db.zip
LibWeb: Make factory method of Encoding::TextEncoder fallible
Diffstat (limited to 'Userland/Libraries/LibWeb/Encoding')
-rw-r--r--Userland/Libraries/LibWeb/Encoding/TextEncoder.cpp5
-rw-r--r--Userland/Libraries/LibWeb/Encoding/TextEncoder.h2
2 files changed, 4 insertions, 3 deletions
diff --git a/Userland/Libraries/LibWeb/Encoding/TextEncoder.cpp b/Userland/Libraries/LibWeb/Encoding/TextEncoder.cpp
index d673df6dfe..224f7df285 100644
--- a/Userland/Libraries/LibWeb/Encoding/TextEncoder.cpp
+++ b/Userland/Libraries/LibWeb/Encoding/TextEncoder.cpp
@@ -8,12 +8,13 @@
#include <LibJS/Runtime/TypedArray.h>
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/Encoding/TextEncoder.h>
+#include <LibWeb/WebIDL/ExceptionOr.h>
namespace Web::Encoding {
-JS::NonnullGCPtr<TextEncoder> TextEncoder::construct_impl(JS::Realm& realm)
+WebIDL::ExceptionOr<JS::NonnullGCPtr<TextEncoder>> TextEncoder::construct_impl(JS::Realm& realm)
{
- return realm.heap().allocate<TextEncoder>(realm, realm).release_allocated_value_but_fixme_should_propagate_errors();
+ return MUST_OR_THROW_OOM(realm.heap().allocate<TextEncoder>(realm, realm));
}
TextEncoder::TextEncoder(JS::Realm& realm)
diff --git a/Userland/Libraries/LibWeb/Encoding/TextEncoder.h b/Userland/Libraries/LibWeb/Encoding/TextEncoder.h
index 9d8b6e41bf..3396004486 100644
--- a/Userland/Libraries/LibWeb/Encoding/TextEncoder.h
+++ b/Userland/Libraries/LibWeb/Encoding/TextEncoder.h
@@ -20,7 +20,7 @@ class TextEncoder final : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(TextEncoder, Bindings::PlatformObject);
public:
- static JS::NonnullGCPtr<TextEncoder> construct_impl(JS::Realm&);
+ static WebIDL::ExceptionOr<JS::NonnullGCPtr<TextEncoder>> construct_impl(JS::Realm&);
virtual ~TextEncoder() override;