Commit a7ee0c2
committed
fix(urlpattern): match capture groups in test()/exec()
v8_regex_provider::regex_search had two bugs that made URLPattern matching
fail (or crash) for any pattern with capture groups:
- The ToLocal(&item) success check was inverted, so the first successfully
read match element bailed out as "no match" and test()/exec() always
returned false/null.
- It included match element 0 (the whole-match string). ada's
create_component_match_result pairs exec_result[i] with group_name_list[i]
and expects only the capture groups, so the extra element overran
group_name_list and crashed once the inverted check was fixed.
Iterate from index 1 and bail only when reading an element fails.
Add URLPattern regression tests covering test() match/non-match and exec()
named capture-group extraction and null-on-no-match.1 parent 268178c commit a7ee0c2
2 files changed
Lines changed: 31 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
77 | 83 | | |
78 | | - | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
79 | 89 | | |
80 | 90 | | |
81 | 91 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
49 | 68 | | |
0 commit comments