mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 14:47:46 +00:00
LibWeb: Remove one remaining use of JS::InvalidCharacterError
This commit is contained in:
parent
adc5ac35b7
commit
92295b9584
1 changed files with 5 additions and 2 deletions
|
@ -390,8 +390,11 @@ JS_DEFINE_NATIVE_FUNCTION(WindowObject::btoa)
|
||||||
Vector<u8> byte_string;
|
Vector<u8> byte_string;
|
||||||
byte_string.ensure_capacity(string.length());
|
byte_string.ensure_capacity(string.length());
|
||||||
for (u32 code_point : Utf8View(string)) {
|
for (u32 code_point : Utf8View(string)) {
|
||||||
if (code_point > 0xff)
|
if (code_point > 0xff) {
|
||||||
return vm.throw_completion<JS::InvalidCharacterError>(JS::ErrorType::NotAByteString, "btoa");
|
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);
|
byte_string.append(code_point);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue