mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:38:10 +00:00
LibWeb/WebIDL: Store SimpleException message as a String{,View} variant
This commit is contained in:
parent
1032ac2453
commit
11b40dbcf5
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