1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 15:37:46 +00:00

LibWeb: Remove one remaining use of JS::InvalidCharacterError

This commit is contained in:
Linus Groh 2022-08-26 23:19:15 +01:00
parent adc5ac35b7
commit 92295b9584

View file

@ -390,8 +390,11 @@ JS_DEFINE_NATIVE_FUNCTION(WindowObject::btoa)
Vector<u8> byte_string;
byte_string.ensure_capacity(string.length());
for (u32 code_point : Utf8View(string)) {
if (code_point > 0xff)
return vm.throw_completion<JS::InvalidCharacterError>(JS::ErrorType::NotAByteString, "btoa");
if (code_point > 0xff) {
return Bindings::throw_dom_exception_if_needed(vm, [] {
return DOM::InvalidCharacterError::create("Data contains characters outside the range U+0000 and U+00FF");
}).release_error();
}
byte_string.append(code_point);
}