commit 3ae7131cd221ff5a9b590e78066101e5969c2c62
parent 663f98a4556cc917036850648cb494133b30e197
Author: Ed Guloien <edgul@mozilla.com>
Date: Fri, 19 Dec 2025 15:21:29 +0000
Bug 2005071 - Fixed urlpattern bug where labels are not correctly added to match output groups r=necko-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D276858
Diffstat:
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/netwerk/base/urlpattern_glue/URLPatternGlue.cpp b/netwerk/base/urlpattern_glue/URLPatternGlue.cpp
@@ -87,8 +87,6 @@ Maybe<UrlpComponentResult> ComponentMatches(UrlpComponent& aComponent,
if (aInput != "") {
return Nothing();
}
- } else if (aComponent.regexp_string == "^(.*)$") { // any string
- res.mGroups.InsertOrUpdate("0"_ns, CreateMaybeString(aInput, true));
} else { // check deeper match
nsTArray<MaybeString> matches;
if (!urlp_matcher_matches_component(&aComponent.matcher, &aInput,
diff --git a/testing/web-platform/tests/urlpattern/resources/urlpatterntestdata.json b/testing/web-platform/tests/urlpattern/resources/urlpatterntestdata.json
@@ -3108,5 +3108,15 @@
"hostname": { "input": "www.example.com", "groups": {} },
"pathname": { "input": "/path/with/x", "groups": { "0": "path/with/x" } }
}
+ },
+ {
+ "pattern": [{ "hostname": ":domain(.*)" }],
+ "inputs": [{ "hostname": "localhost" }],
+ "expected_obj": {
+ "hostname": ":domain(.*)"
+ },
+ "expected_match": {
+ "hostname": { "input": "localhost", "groups": { "domain" : "localhost"} }
+ }
}
]