From 15e3a99250f5f0c4efc1ea3a6e8e96e6363e32ad Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Tue, 30 Aug 2022 10:22:51 +0100 Subject: [PATCH] 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 --- Userland/Libraries/LibJS/Runtime/Value.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibJS/Runtime/Value.cpp b/Userland/Libraries/LibJS/Runtime/Value.cpp index b0a7ea2d61..1570d54d43 100644 --- a/Userland/Libraries/LibJS/Runtime/Value.cpp +++ b/Userland/Libraries/LibJS/Runtime/Value.cpp @@ -675,7 +675,7 @@ Optional 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);