1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 17:15:09 +00:00

LibWeb: Make DOMException GC-allocated

This commit is contained in:
Andreas Kling 2022-09-04 16:56:15 +02:00
parent 0e47754ac8
commit 497ead37bc
58 changed files with 307 additions and 278 deletions

View file

@ -1067,11 +1067,8 @@ JS_DEFINE_NATIVE_FUNCTION(Window::btoa)
Vector<u8> byte_string;
byte_string.ensure_capacity(string.length());
for (u32 code_point : Utf8View(string)) {
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();
}
if (code_point > 0xff)
return throw_completion(DOM::InvalidCharacterError::create(vm.current_realm()->global_object(), "Data contains characters outside the range U+0000 and U+00FF"));
byte_string.append(code_point);
}