commit 27f5ac699af07308304ac033e7b81642598dc237
parent d66714b3c2d13d04c19bba6726f56412caaf9900
Author: Valentin Gosu <valentin.gosu@gmail.com>
Date: Wed, 5 Nov 2025 14:35:04 +0000
Bug 1998271 - Add test for urlpattern with x in path r=necko-reviewers,jesup
Differential Revision: https://phabricator.services.mozilla.com/D271360
Diffstat:
1 file changed, 75 insertions(+), 0 deletions(-)
diff --git a/testing/web-platform/tests/urlpattern/resources/urlpatterntestdata.json b/testing/web-platform/tests/urlpattern/resources/urlpatterntestdata.json
@@ -3033,5 +3033,80 @@
"hostname": { "input": "example.com", "groups": {} },
"pathname": { "input": "/", "groups": { "0": "/" } }
}
+ },
+ {
+ "pattern": ["https://www.example.com/*"],
+ "inputs": ["https://www.example.com/x"],
+ "exactly_empty_components": ["port"],
+ "expected_obj": {
+ "protocol": "https",
+ "hostname": "www.example.com",
+ "pathname": "/*"
+ },
+ "expected_match": {
+ "protocol": { "input": "https", "groups": {} },
+ "hostname": { "input": "www.example.com", "groups": {} },
+ "pathname": { "input": "/x", "groups": { "0": "x" } }
+ }
+ },
+ {
+ "pattern": ["https://www.example.com/*"],
+ "inputs": ["https://www.example.com/xyz"],
+ "exactly_empty_components": ["port"],
+ "expected_obj": {
+ "protocol": "https",
+ "hostname": "www.example.com",
+ "pathname": "/*"
+ },
+ "expected_match": {
+ "protocol": { "input": "https", "groups": {} },
+ "hostname": { "input": "www.example.com", "groups": {} },
+ "pathname": { "input": "/xyz", "groups": { "0": "xyz" } }
+ }
+ },
+ {
+ "pattern": ["https://www.example.com/*"],
+ "inputs": ["https://www.example.com/example"],
+ "exactly_empty_components": ["port"],
+ "expected_obj": {
+ "protocol": "https",
+ "hostname": "www.example.com",
+ "pathname": "/*"
+ },
+ "expected_match": {
+ "protocol": { "input": "https", "groups": {} },
+ "hostname": { "input": "www.example.com", "groups": {} },
+ "pathname": { "input": "/example", "groups": { "0": "example" } }
+ }
+ },
+ {
+ "pattern": ["https://www.example.com/*"],
+ "inputs": ["https://www.example.com/text"],
+ "exactly_empty_components": ["port"],
+ "expected_obj": {
+ "protocol": "https",
+ "hostname": "www.example.com",
+ "pathname": "/*"
+ },
+ "expected_match": {
+ "protocol": { "input": "https", "groups": {} },
+ "hostname": { "input": "www.example.com", "groups": {} },
+ "pathname": { "input": "/text", "groups": { "0": "text" } }
+ }
+ },
+ {
+ "pattern": ["https://www.example.com/*"],
+ "inputs": ["https://www.example.com/path/with/x"],
+ "exactly_empty_components": ["port"],
+ "expected_obj": {
+ "protocol": "https",
+ "hostname": "www.example.com",
+ "pathname": "/*"
+ },
+ "expected_match": {
+ "protocol": { "input": "https", "groups": {} },
+ "hostname": { "input": "www.example.com", "groups": {} },
+ "pathname": { "input": "/path/with/x", "groups": { "0": "path/with/x" } }
+ }
}
]