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

LibJS: Trim non-ASCII whitespace as well in StringToBigInt

This was never caught since the original implementation AFAICT, and
isn't being covered by test262 either:
https://github.com/tc39/test262/issues/1354
This commit is contained in:
Linus Groh 2022-08-30 10:22:51 +01:00
parent c88c33dc22
commit 15e3a99250

View file

@ -675,7 +675,7 @@ Optional<BigInt*> Value::string_to_bigint(VM& vm) const
VERIFY(is_string());
// 1. Let text be StringToCodePoints(str).
auto text = as_string().string().view().trim_whitespace();
auto text = Utf8View(as_string().string().view()).trim(whitespace_characters, AK::TrimMode::Both).as_string();
// 2. Let literal be ParseText(text, StringIntegerLiteral).
auto result = parse_bigint_text(text);