Skip to content

Commit

Permalink
URLPattern: Throw on more illegal hostname code points.
Browse files Browse the repository at this point in the history
As discussed in the mozilla standards-position issue on URLPattern:

mozilla/standards-positions#566

There are a number of URL encoding interop issues between browsers.
Since URLPattern delegates to the URL parser for canonicalization it
is also exposed to these interop issues.

While fixing all of URL's interop issues is orthogonal to shipping
URLPattern, we can at least prevent clearly illegal code points from
being used in URLPattern.  This will avoid increasing usage of these
code points which will in turn make it slightly easier to fix the issue
in the URL parser in the future.

Bug: 1248061
Change-Id: I58a55e4206004a6cba727f19d537c5929ce16d43
  • Loading branch information
wanderview authored and chromium-wpt-export-bot committed Sep 9, 2021
1 parent ef3d38e commit 443321f
Showing 1 changed file with 68 additions and 0 deletions.
68 changes: 68 additions & 0 deletions urlpattern/resources/urlpatterntestdata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2359,5 +2359,73 @@
"expected_match": {
"protocol": { "input": "foobar", "groups": { "name": "foobar" }}
}
},
{
"pattern": [{ "hostname": "bad hostname" }],
"expected_obj": "error"
},
{
"pattern": [{ "hostname": "bad#hostname" }],
"expected_obj": "error"
},
{
"pattern": [{ "hostname": "bad%hostname" }],
"expected_obj": "error"
},
{
"pattern": [{ "hostname": "bad/hostname" }],
"expected_obj": "error"
},
{
"pattern": [{ "hostname": "bad\\:hostname" }],
"expected_obj": "error"
},
{
"pattern": [{ "hostname": "bad<hostname" }],
"expected_obj": "error"
},
{
"pattern": [{ "hostname": "bad>hostname" }],
"expected_obj": "error"
},
{
"pattern": [{ "hostname": "bad?hostname" }],
"expected_obj": "error"
},
{
"pattern": [{ "hostname": "bad@hostname" }],
"expected_obj": "error"
},
{
"pattern": [{ "hostname": "bad[hostname" }],
"expected_obj": "error"
},
{
"pattern": [{ "hostname": "bad]hostname" }],
"expected_obj": "error"
},
{
"pattern": [{ "hostname": "bad\\\\hostname" }],
"expected_obj": "error"
},
{
"pattern": [{ "hostname": "bad^hostname" }],
"expected_obj": "error"
},
{
"pattern": [{ "hostname": "bad|hostname" }],
"expected_obj": "error"
},
{
"pattern": [{ "hostname": "bad\nhostname" }],
"expected_obj": "error"
},
{
"pattern": [{ "hostname": "bad\rhostname" }],
"expected_obj": "error"
},
{
"pattern": [{ "hostname": "bad\thostname" }],
"expected_obj": "error"
}
]

0 comments on commit 443321f

Please sign in to comment.