Skip to content

Commit

Permalink
URLPattern: Support pattern syntax in IPv6 hostnames.
Browse files Browse the repository at this point in the history
This adds support for patterns that having matching syntax inside of
IPv6 address hostnames like:

  new URLPattern({ hostname: '[:address]' });

This issue is discussed here:

  whatwg/urlpattern#115

This CL also does a drive-by fix of a stale header reference in the
blink presubmit warnings.

Fixed: 1245998
Change-Id: I772258dc69c2b658ee4d7306b4f1975324624338
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3140140
Reviewed-by: Jeremy Roman <jbroman@chromium.org>
Reviewed-by: Stephen McGruer <smcgruer@chromium.org>
Commit-Queue: Ben Kelly <wanderview@chromium.org>
Cr-Commit-Position: refs/heads/main@{#919392}
  • Loading branch information
wanderview authored and chromium-wpt-export-bot committed Sep 8, 2021
1 parent 149d0e5 commit 9ed05ce
Showing 1 changed file with 79 additions and 0 deletions.
79 changes: 79 additions & 0 deletions urlpattern/resources/urlpatterntestdata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2199,6 +2199,85 @@
"pathname": { "input": "/", "groups": {} }
}
},
{
"pattern": [ "http://[:address]/" ],
"inputs": [ "http://[::1]/" ],
"exactly_empty_components": [ "username", "password", "port", "search",
"hash" ],
"expected_obj": {
"protocol": "http",
"hostname": "[:address]",
"pathname": "/"
},
"expected_match": {
"protocol": { "input": "http", "groups": {} },
"hostname": { "input": "[::1]", "groups": { "address": "::1" }},
"pathname": { "input": "/", "groups": {} }
}
},
{
"pattern": [ "http://[\\:\\:AB\\::num]/" ],
"inputs": [ "http://[::ab:1]/" ],
"exactly_empty_components": [ "username", "password", "port", "search",
"hash" ],
"expected_obj": {
"protocol": "http",
"hostname": "[\\:\\:ab\\::num]",
"pathname": "/"
},
"expected_match": {
"protocol": { "input": "http", "groups": {} },
"hostname": { "input": "[::ab:1]", "groups": { "num": "1" }},
"pathname": { "input": "/", "groups": {} }
}
},
{
"pattern": [{ "hostname": "[\\:\\:AB\\::num]" }],
"inputs": [{ "hostname": "[::ab:1]" }],
"expected_obj": {
"hostname": "[\\:\\:ab\\::num]"
},
"expected_match": {
"hostname": { "input": "[::ab:1]", "groups": { "num": "1" }}
}
},
{
"pattern": [{ "hostname": "[\\:\\:xY\\::num]" }],
"expected_obj": "error"
},
{
"pattern": [{ "hostname": "{[\\:\\:ab\\::num]}" }],
"inputs": [{ "hostname": "[::ab:1]" }],
"expected_match": {
"hostname": { "input": "[::ab:1]", "groups": { "num": "1" }}
}
},
{
"pattern": [{ "hostname": "{[\\:\\:fé\\::num]}" }],
"expected_obj": "error"
},
{
"pattern": [{ "hostname": "{[\\:\\::num\\:1]}" }],
"inputs": [{ "hostname": "[::ab:1]" }],
"expected_match": {
"hostname": { "input": "[::ab:1]", "groups": { "num": "ab" }}
}
},
{
"pattern": [{ "hostname": "{[\\:\\::num\\:fé]}" }],
"expected_obj": "error"
},
{
"pattern": [{ "hostname": "[*\\:1]" }],
"inputs": [{ "hostname": "[::ab:1]" }],
"expected_match": {
"hostname": { "input": "[::ab:1]", "groups": { "0": "::ab" }}
}
},
{
"pattern": [{ "hostname": "*\\:1]" }],
"expected_obj": "error"
},
{
"pattern": [ "https://foo{{@}}example.com" ],
"inputs": [ "https://foo@example.com" ],
Expand Down

0 comments on commit 9ed05ce

Please sign in to comment.