Commit 07ebe59
authored
fix(engine): use code_unit_at instead of code_point_at in URI Decode (#5168)
This Pull Request fixes/closes #5166.
It changes the following:
- Fixes URI Decode to read UTF-16 code units at index k instead of
reading a code point and truncating to u16.
- Corrects `decodeURI` and `decodeURIComponent` behavior for non-BMP
characters such as `\uD83D\uDE00`, matching ECMAScript Decode step 4.b
and Node/Chrome behavior.
- Adds regression tests to keep non-BMP decode behavior correct.
Testing:
- `cargo test -p boa_engine uri`
- `cargo fmt --all`
Spec reference:
https://tc39.es/ecma262/#sec-decode1 parent e2ab577 commit 07ebe59
1 file changed
+17
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
379 | 379 | | |
380 | 380 | | |
381 | 381 | | |
382 | | - | |
383 | | - | |
384 | | - | |
385 | | - | |
386 | 382 | | |
387 | | - | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
388 | 386 | | |
389 | 387 | | |
390 | 388 | | |
| |||
589 | 587 | | |
590 | 588 | | |
591 | 589 | | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
592 | 604 | | |
0 commit comments