Skip to content

Commit

Permalink
URLPattern: Support constructor strings with ipv6 addresses.
Browse files Browse the repository at this point in the history
This adds support for constructor strings like:

  new URLPattern("http://[\\:\\:1]/");

As discussed in spec issue #113:

  whatwg/urlpattern#113

Fixed: 1245760
Change-Id: I712341e72a5c2af745dbbdbb8673a79809a98425
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3138336
Commit-Queue: Ben Kelly <wanderview@chromium.org>
Reviewed-by: Jeremy Roman <jbroman@chromium.org>
Cr-Commit-Position: refs/heads/main@{#917682}
  • Loading branch information
wanderview authored and chromium-wpt-export-bot committed Sep 2, 2021
1 parent 69a086e commit 8bd7648
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions urlpattern/resources/urlpatterntestdata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2150,6 +2150,55 @@
"pathname": { "input": "/data:channel.html", "groups": {} }
}
},
{
"pattern": [ "http://[\\:\\:1]/" ],
"inputs": [ "http://[::1]/" ],
"exactly_empty_components": [ "username", "password", "port", "search",
"hash" ],
"expected_obj": {
"protocol": "http",
"hostname": "[\\:\\:1]",
"pathname": "/"
},
"expected_match": {
"protocol": { "input": "http", "groups": {} },
"hostname": { "input": "[::1]", "groups": {} },
"pathname": { "input": "/", "groups": {} }
}
},
{
"pattern": [ "http://[\\:\\:1]:8080/" ],
"inputs": [ "http://[::1]:8080/" ],
"exactly_empty_components": [ "username", "password", "search", "hash" ],
"expected_obj": {
"protocol": "http",
"hostname": "[\\:\\:1]",
"port": "8080",
"pathname": "/"
},
"expected_match": {
"protocol": { "input": "http", "groups": {} },
"hostname": { "input": "[::1]", "groups": {} },
"port": { "input": "8080", "groups": {} },
"pathname": { "input": "/", "groups": {} }
}
},
{
"pattern": [ "http://[\\:\\:a]/" ],
"inputs": [ "http://[::a]/" ],
"exactly_empty_components": [ "username", "password", "port", "search",
"hash" ],
"expected_obj": {
"protocol": "http",
"hostname": "[\\:\\:a]",
"pathname": "/"
},
"expected_match": {
"protocol": { "input": "http", "groups": {} },
"hostname": { "input": "[::a]", "groups": {} },
"pathname": { "input": "/", "groups": {} }
}
},
{
"pattern": [ "https://foo{{@}}example.com" ],
"inputs": [ "https://foo@example.com" ],
Expand Down

0 comments on commit 8bd7648

Please sign in to comment.