Use kUnicodeSets (v regexp flag) in URLPattern #43014
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This CL follows the recent spec update in [1]. After this CL, the
regular expression works with the unicodeSet mode, which allows the API
to interpret set notations, multi-codepoint properties etc.
Actually, this CL ends up only adding the support for set notations. At
the moment the API doesn't accept unicode character class escape (\p{},
\P{}) [2], thus we wouldn't add the multi-codepoint match functionarity.
There are some incompatibility between "u" and "v", some patterns are
privously valid but now errors. However, from UMA the impact looks very
limited, it's only around 0.3% of the total constructor calls.
So this CL changes the default flag to "v". Also add a kill switch.
[1] whatwg/urlpattern#178
[2] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Regular_expressions/Unicode_character_class_escape
Change-Id: I14cc3420d57cca44c0c25867d05802a8a666cd8c
Bug: 1482263
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4861342
Reviewed-by: Jeremy Roman <jbroman@chromium.org>
Commit-Queue: Shunya Shishido <sisidovski@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1221823}