Skip to content

Commit da9a991

Browse files
committed
revert opaque host change
1 parent 580374b commit da9a991

File tree

2 files changed

+83
-1
lines changed

2 files changed

+83
-1
lines changed

src/url_pattern.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ tl::expected<url_pattern_init, errors> url_pattern_init::process(
211211
// - baseURL has an opaque path; and
212212
// - the result of running is an absolute pathname given result["pathname"]
213213
// and type is false,
214-
if (base_url && base_url->has_opaque_path &&
214+
if (base_url && !base_url->has_opaque_path &&
215215
!url_pattern_helpers::is_absolute_pathname(*result.pathname, type)) {
216216
// Let baseURLPath be the result of running process a base URL string
217217
// given the result of URL path serializing baseURL and type.

tests/wpt/urlpatterntestdata.json

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,6 +1239,32 @@
12391239
"pathname": { "input": "/bar", "groups": {}}
12401240
}
12411241
},
1242+
{
1243+
"pattern": [{ "pathname": "./foo/bar", "baseURL": "https://example.com" }],
1244+
"inputs": [{ "pathname": "foo/bar", "baseURL": "https://example.com" }],
1245+
"exactly_empty_components": [ "port" ],
1246+
"expected_obj": {
1247+
"pathname": "/foo/bar"
1248+
},
1249+
"expected_match": {
1250+
"protocol": { "input": "https", "groups": {}},
1251+
"hostname": { "input": "example.com", "groups": {}},
1252+
"pathname": { "input": "/foo/bar", "groups": {}}
1253+
}
1254+
},
1255+
{
1256+
"pattern": [{ "pathname": "", "baseURL": "https://example.com" }],
1257+
"inputs": [{ "pathname": "/", "baseURL": "https://example.com" }],
1258+
"exactly_empty_components": [ "port" ],
1259+
"expected_obj": {
1260+
"pathname": "/"
1261+
},
1262+
"expected_match": {
1263+
"protocol": { "input": "https", "groups": {}},
1264+
"hostname": { "input": "example.com", "groups": {}},
1265+
"pathname": { "input": "/", "groups": {}}
1266+
}
1267+
},
12421268
{
12431269
"pattern": [{ "pathname": "{/bar}", "baseURL": "https://example.com/foo/" }],
12441270
"inputs": [{ "pathname": "./bar", "baseURL": "https://example.com/foo/" }],
@@ -1257,11 +1283,50 @@
12571283
},
12581284
"expected_match": null
12591285
},
1286+
{
1287+
"pattern": [{ "pathname": "b", "baseURL": "https://example.com/foo/" }],
1288+
"inputs": [{ "pathname": "./b", "baseURL": "https://example.com/foo/" }],
1289+
"exactly_empty_components": [ "port" ],
1290+
"expected_obj": {
1291+
"pathname": "/foo/b"
1292+
},
1293+
"expected_match": {
1294+
"protocol": { "input": "https", "groups": {}},
1295+
"hostname": { "input": "example.com", "groups": {}},
1296+
"pathname": { "input": "/foo/b", "groups": {}}
1297+
}
1298+
},
12601299
{
12611300
"pattern": [{ "pathname": "foo/bar" }],
12621301
"inputs": [ "https://example.com/foo/bar" ],
12631302
"expected_match": null
12641303
},
1304+
{
1305+
"pattern": [{ "pathname": "foo/bar", "baseURL": "https://example.com" }],
1306+
"inputs": [ "https://example.com/foo/bar" ],
1307+
"exactly_empty_components": [ "port" ],
1308+
"expected_obj": {
1309+
"pathname": "/foo/bar"
1310+
},
1311+
"expected_match": {
1312+
"protocol": { "input": "https", "groups": {}},
1313+
"hostname": { "input": "example.com", "groups": {}},
1314+
"pathname": { "input": "/foo/bar", "groups": {}}
1315+
}
1316+
},
1317+
{
1318+
"pattern": [{ "pathname": ":name.html", "baseURL": "https://example.com" }],
1319+
"inputs": [ "https://example.com/foo.html"] ,
1320+
"exactly_empty_components": [ "port" ],
1321+
"expected_obj": {
1322+
"pathname": "/:name.html"
1323+
},
1324+
"expected_match": {
1325+
"protocol": { "input": "https", "groups": {}},
1326+
"hostname": { "input": "example.com", "groups": {}},
1327+
"pathname": { "input": "/foo.html", "groups": { "name": "foo" }}
1328+
}
1329+
},
12651330
{
12661331
"pattern": [{ "search": "q=caf%C3%A9" }],
12671332
"inputs": [{ "search": "q=café" }],
@@ -2072,6 +2137,23 @@
20722137
},
20732138
"expected_match": null
20742139
},
2140+
{
2141+
"pattern": [ "data{\\:}channel.html", "https://example.com" ],
2142+
"inputs": [ "https://example.com/data:channel.html" ],
2143+
"exactly_empty_components": [ "port" ],
2144+
"expected_obj": {
2145+
"protocol": "https",
2146+
"hostname": "example.com",
2147+
"pathname": "/data\\:channel.html",
2148+
"search": "*",
2149+
"hash": "*"
2150+
},
2151+
"expected_match": {
2152+
"protocol": { "input": "https", "groups": {} },
2153+
"hostname": { "input": "example.com", "groups": {} },
2154+
"pathname": { "input": "/data:channel.html", "groups": {} }
2155+
}
2156+
},
20752157
{
20762158
"pattern": [ "http://[\\:\\:1]/" ],
20772159
"inputs": [ "http://[::1]/" ],

0 commit comments

Comments
 (0)