mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 05:39:11 +00:00
AK+LibJS: Do not set UTF-16 code point length to its code unit length
This commit is contained in:
parent
594194eb60
commit
efa9737cf7
Notes:
github-actions[bot]
2025-06-25 20:22:15 +00:00
Author: https://github.com/trflynn89
Commit: efa9737cf7
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5214
Reviewed-by: https://github.com/gmta ✅
3 changed files with 25 additions and 1 deletions
|
@ -212,3 +212,17 @@ test("string coercion", () => {
|
|||
expect(result[0]).toBe("1");
|
||||
expect(result.index).toBe(0);
|
||||
});
|
||||
|
||||
test("cached UTF-16 code point length", () => {
|
||||
// This exercises a regression where we incorrectly cached the code point length of the `match` string,
|
||||
// causing subsequent code point lookups on that string to be incorrect.
|
||||
const regex = /\p{Emoji_Presentation}/u;
|
||||
|
||||
let result = regex.exec("😀");
|
||||
let match = result[0];
|
||||
|
||||
result = regex.exec(match);
|
||||
match = result[0];
|
||||
|
||||
expect(match.codePointAt(0)).toBe(0x1f600);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue