mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-23 01:12:45 +00:00
LibJS+LibWeb: Replace JS::Utf16String with AK::Utf16String
This commit is contained in:
parent
d40e3af697
commit
a43cb15e81
Notes:
github-actions[bot]
2025-07-18 16:46:59 +00:00
Author: https://github.com/trflynn89
Commit: a43cb15e81
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5388
Reviewed-by: https://github.com/shannonbooth ✅
24 changed files with 172 additions and 526 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue