LibJS+LibWeb: Replace JS::Utf16String with AK::Utf16String

This commit is contained in:
Timothy Flynn 2025-07-09 14:13:22 -04:00 committed by Tim Flynn
parent d40e3af697
commit a43cb15e81
Notes: github-actions[bot] 2025-07-18 16:46:59 +00:00
24 changed files with 172 additions and 526 deletions

View file

@ -387,7 +387,7 @@ JS_DEFINE_NATIVE_FUNCTION(GlobalObject::parse_int)
// 19.2.6.5 Encode ( string, extraUnescaped ), https://tc39.es/ecma262/#sec-encode
static ThrowCompletionOr<ByteString> encode(VM& vm, ByteString const& string, StringView unescaped_set)
{
auto utf16_string = Utf16String::create(string);
auto utf16_string = Utf16String::from_utf8(string);
// 1. Let strLen be the length of string.
auto string_length = utf16_string.length_in_code_units();
@ -421,7 +421,7 @@ static ThrowCompletionOr<ByteString> encode(VM& vm, ByteString const& string, St
// d. Else,
else {
// i. Let cp be CodePointAt(string, k).
auto code_point = code_point_at(utf16_string.view(), k);
auto code_point = code_point_at(utf16_string, k);
// ii. If cp.[[IsUnpairedSurrogate]] is true, throw a URIError exception.
if (code_point.is_unpaired_surrogate)
return vm.throw_completion<URIError>(ErrorType::URIMalformed);