diff options
author | Linus Groh <mail@linusgroh.de> | 2023-03-03 18:04:58 +0000 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2023-03-03 19:50:36 +0000 |
commit | 11b40dbcf5f19971aa601099c1be26a77b8194eb (patch) | |
tree | 31a7f0bac699e7e2fca6c1570013148a7b024452 /Userland/Libraries/LibWeb/Encoding/TextDecoder.cpp | |
parent | 1032ac2453e7c276152db1a5c9f9a55b377d7419 (diff) | |
download | serenity-11b40dbcf5f19971aa601099c1be26a77b8194eb.zip |
LibWeb/WebIDL: Store SimpleException message as a String{,View} variant
Diffstat (limited to 'Userland/Libraries/LibWeb/Encoding/TextDecoder.cpp')
-rw-r--r-- | Userland/Libraries/LibWeb/Encoding/TextDecoder.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Userland/Libraries/LibWeb/Encoding/TextDecoder.cpp b/Userland/Libraries/LibWeb/Encoding/TextDecoder.cpp index 1420352dbc..d975b7f8b5 100644 --- a/Userland/Libraries/LibWeb/Encoding/TextDecoder.cpp +++ b/Userland/Libraries/LibWeb/Encoding/TextDecoder.cpp @@ -14,9 +14,11 @@ namespace Web::Encoding { WebIDL::ExceptionOr<JS::NonnullGCPtr<TextDecoder>> TextDecoder::construct_impl(JS::Realm& realm, DeprecatedFlyString encoding) { + auto& vm = realm.vm(); + auto decoder = TextCodec::decoder_for(encoding); if (!decoder.has_value()) - return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, DeprecatedString::formatted("Invalid encoding {}", encoding) }; + return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, TRY_OR_THROW_OOM(vm, String::formatted("Invalid encoding {}", encoding)) }; return MUST_OR_THROW_OOM(realm.heap().allocate<TextDecoder>(realm, realm, *decoder, move(encoding), false, false)); } |