fix(urlpattern): match capture groups in test()/exec()#402
Conversation
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.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughFixes a bug in ChangesURLPattern Regex Fix
Estimated code review effort: 2 (Simple) | ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
v8_regex_provider::regex_search had two bugs that made URLPattern matching fail (or crash) for any pattern with capture groups:
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.
Summary by CodeRabbit