URLPattern: Implement exec().
This CL provides an initial implementation of the URLPattern.exec() method. It mainly differs from test() in that it returns a full URLPatternResult object instead of just a boolean. The result object looks something like: { input: <input string or object passed to exec()>, protocol: <component result>, username: <component result>, password: <component result>, hostname: <component result>, port: <component result>, pathname: <component result>, search: <component result>, hash: <component result> } Each URLPatternComponentResult looks like: { input: <input component string>, groups: { <group name or numeric number string>: <matched group value> } } To support extracting matched group values this CL enhances ScriptRegexp to populate an optional vector of strings. In addition, this CL enhances the WPT tests to process expected result objects. In general it is only necessary to provide component results for components that match non-empty inputs. The test runner will automatically add expected results for empty components. This CL also contains a fix in ApplyInit()'s handling of baseURL. The intent was to treat non-specified components as the explicit empty string. The code now does this. This also happens to handle the unexpected behavior of KURL::GetPass() which always returns a null string in place of an empty string. Finally, this CL removes the toRegex() stub as well. That API is unlikely to land in the current form, so lets just remove it until it can be properly designed. Bug: 1141510 Change-Id: Iedd0598a3d5e493c3e7ed0eb5dce4b09019abca3 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2575343 Commit-Queue: Ben Kelly <wanderview@chromium.org> Reviewed-by:Jeremy Roman <jbroman@chromium.org> Cr-Commit-Position: refs/heads/master@{#834967}
Showing
This diff is collapsed.
This diff is collapsed.
Please register or sign in to comment