Skip to content

Commit 917e7d6

Browse files
wanderviewchromium-wpt-export-bot
authored andcommitted
URLPattern: Escape pattern baseURL values.
This addresses the problem described in this spec issue: whatwg/urlpattern#170 And this spec PR: whatwg/urlpattern#172 Bug: 1380534 Change-Id: I37b5f77e674f8c23ff59e6224d92c7a0d767e7cf
1 parent c82e314 commit 917e7d6

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

urlpattern/resources/urlpatterntestdata.json

+45
Original file line numberDiff line numberDiff line change
@@ -2794,5 +2794,50 @@
27942794
"inputs": [{ "pathname": "/FOO", "search": "BAR", "hash": "BAZ",
27952795
"baseURL": "https://example.com:8080" }],
27962796
"expected_obj": "error"
2797+
},
2798+
{
2799+
"pattern": [{ "search": "foo", "baseURL": "https://example.com/a/+/b" }],
2800+
"inputs": [{ "search": "foo", "baseURL": "https://example.com/a/+/b" }],
2801+
"exactly_empty_components": [ "username", "password", "port", "hash" ],
2802+
"expected_obj": {
2803+
"pathname": "/a/\\+/b"
2804+
},
2805+
"expected_match": {
2806+
"hostname": { "input": "example.com", "groups": {} },
2807+
"pathname": { "input": "/a/+/b", "groups": {} },
2808+
"protocol": { "input": "https", "groups": {} },
2809+
"search": { "input": "foo", "groups": {} }
2810+
}
2811+
},
2812+
{
2813+
"pattern": [{ "hash": "foo", "baseURL": "https://example.com/?q=*&v=?&hmm={}&umm=()" }],
2814+
"inputs": [{ "hash": "foo", "baseURL": "https://example.com/?q=*&v=?&hmm={}&umm=()" }],
2815+
"exactly_empty_components": [ "username", "password", "port" ],
2816+
"expected_obj": {
2817+
"search": "q=\\*&v=\\?&hmm=\\{\\}&umm=\\(\\)"
2818+
},
2819+
"expected_match": {
2820+
"hostname": { "input": "example.com", "groups": {} },
2821+
"pathname": { "input": "/", "groups": {} },
2822+
"protocol": { "input": "https", "groups": {} },
2823+
"search": { "input": "q=*&v=?&hmm={}&umm=()", "groups": {} },
2824+
"hash": { "input": "foo", "groups": {} }
2825+
}
2826+
},
2827+
{
2828+
"pattern": [ "#foo", "https://example.com/?q=*&v=?&hmm={}&umm=()" ],
2829+
"inputs": [ "https://example.com/?q=*&v=?&hmm={}&umm=()#foo" ],
2830+
"exactly_empty_components": [ "username", "password", "port" ],
2831+
"expected_obj": {
2832+
"search": "q=\\*&v=\\?&hmm=\\{\\}&umm=\\(\\)",
2833+
"hash": "foo"
2834+
},
2835+
"expected_match": {
2836+
"hostname": { "input": "example.com", "groups": {} },
2837+
"pathname": { "input": "/", "groups": {} },
2838+
"protocol": { "input": "https", "groups": {} },
2839+
"search": { "input": "q=*&v=?&hmm={}&umm=()", "groups": {} },
2840+
"hash": { "input": "foo", "groups": {} }
2841+
}
27972842
}
27982843
]

0 commit comments

Comments
 (0)