mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-16 22:42:18 +00:00
LibWeb/WebIDL: Store SimpleException message as a String{,View} variant
This commit is contained in:
parent
1032ac2453
commit
11b40dbcf5
Notes:
sideshowbarker
2024-07-17 07:35:03 +09:00
Author: https://github.com/linusg
Commit: 11b40dbcf5
Pull-request: https://github.com/SerenityOS/serenity/pull/17704
Reviewed-by: https://github.com/nico ✅
8 changed files with 28 additions and 24 deletions
|
@ -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));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue