tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 6847e4953fdb63788f173c0e300ce2f96dfe8d77
parent d4a1bafec5e85b963d187b30b91b9d59384551c3
Author: Valentin Gosu <valentin.gosu@gmail.com>
Date:   Wed,  5 Nov 2025 14:35:05 +0000

Bug 1998356 - Vendor urlpattern 0.4.1 r=necko-reviewers,supply-chain-reviewers,jesup

Differential Revision: https://phabricator.services.mozilla.com/D271367

Diffstat:
MCargo.lock | 4++--
Mnetwerk/base/urlpattern_glue/Cargo.toml | 2+-
Msupply-chain/audits.toml | 5+++++
Mthird_party/rust/urlpattern/.cargo-checksum.json | 4++--
Mthird_party/rust/urlpattern/Cargo.lock | 124++++++++++++++++++++++++++++++++++++++-----------------------------------------
Mthird_party/rust/urlpattern/Cargo.toml | 2+-
Mthird_party/rust/urlpattern/README.md | 8++------
Mthird_party/rust/urlpattern/src/component.rs | 2+-
Mthird_party/rust/urlpattern/src/lib.rs | 12++++++++++++
Mthird_party/rust/urlpattern/src/regexp.rs | 4++--
Mthird_party/rust/urlpattern/src/testdata/urlpatterntestdata.json | 134++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------
Mtoolkit/library/rust/shared/Cargo.toml | 2+-
12 files changed, 176 insertions(+), 127 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock @@ -7540,9 +7540,9 @@ dependencies = [ [[package]] name = "urlpattern" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d501d76f119ead40238fa03f42a642444d352ad423db5287b70ae63558995a1" +checksum = "957a88ad1abd5d13336275adb17d4f9b6a2404f3baed2e075e0b026dc0b2b58d" dependencies = [ "icu_properties", "regex", diff --git a/netwerk/base/urlpattern_glue/Cargo.toml b/netwerk/base/urlpattern_glue/Cargo.toml @@ -6,7 +6,7 @@ authors = ["Ed Guloien <edgul@mozilla.com>"] license = "MPL-2.0" [dependencies] -urlpattern = "0.4.0" +urlpattern = "0.4.1" url = "2.5.7" regex = "1.10.5" mozurl = { path = "../../../netwerk/base/mozurl" } diff --git a/supply-chain/audits.toml b/supply-chain/audits.toml @@ -6616,6 +6616,11 @@ who = "edgul <ed.guloien@gmail.com>" criteria = "safe-to-deploy" delta = "0.3.0 -> 0.4.0" +[[audits.urlpattern]] +who = "Valentin Gosu <valentin.gosu@gmail.com>" +criteria = "safe-to-deploy" +delta = "0.4.0 -> 0.4.1" + [[audits.utf16_iter]] who = "Henri Sivonen <hsivonen@hsivonen.fi>" criteria = "safe-to-deploy" diff --git a/third_party/rust/urlpattern/.cargo-checksum.json b/third_party/rust/urlpattern/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"Cargo.lock":"1fda43726e8c0d4b8cda82484555565644044263b5375240b1834f8de25af76d","Cargo.toml":"820fb3f996d3bb39e67e647e8cbae8808abab468e503a63a4df274f94b994ce5","LICENSE":"5cf1c9dc617e4cad7fa03181ff893601ad5243aa3be527ef39034e1cd6377676","README.md":"a2980f461122c8a6d19f29efeeabd913501123ef16b4fa2ecd44eb2d7c183c89","src/canonicalize_and_process.rs":"6dd8e987b160e1dc4584a2fca3120ec681e74cdc121d3606b8cb7687a36ca0ca","src/component.rs":"50003db576bfabf886a5632523d4a41689e072df211d516107f562b6ccf85ff5","src/constructor_parser.rs":"3373e1e4f50fc4876ffb2792893bdf2a1b2f662aa4605ea0f94fa4b900dec837","src/error.rs":"a8ee97b888e5ee8eddcf2e97d98615856d322d211a2cd61a49d5b10fce5c8c16","src/lib.rs":"823174de77ac9fab9747248d5c8c3ce82240433c613df99334719fb3110ebc8e","src/matcher.rs":"609a4d3b50be6233d626f356fd46d61fc7ff06491e966f0fd4d99662a12d1833","src/parser.rs":"fcd913c9f8e8e205df509c1c5c76b9ad0de01214e380203fd37eae52a9f688c6","src/quirks.rs":"715d0381a798635af1c126d866af8873a2a5e6e38d34349e86b6ba87b0c01387","src/regexp.rs":"3cbb17b3980230a8839cfe63ba4bf094ce585fd082934641bb9e14c3bf2598c8","src/testdata/urlpatterntestdata.json":"785f3b566d1c0228eb1b3cd9c17c500891f72290a94456d241bd40248fcad4ed","src/tokenizer.rs":"af95251846980cceaeea3f61f6a12367525f4299e511b5c3f84dd8f21a355f6b"},"package":"2d501d76f119ead40238fa03f42a642444d352ad423db5287b70ae63558995a1"} -\ No newline at end of file +{"files":{"Cargo.lock":"d572e29279c1d7a280e7d6989bcdb565d4dcf2447a0db0acd682b5ab38bdc488","Cargo.toml":"ba5dd65763ff17d51d04690a6605f8f4c68e6031704d8b4a1fa8d5d5c3bc2ccf","LICENSE":"5cf1c9dc617e4cad7fa03181ff893601ad5243aa3be527ef39034e1cd6377676","README.md":"b94472cd652246ca8836702b9bdd3809508627aa0a552d09c9b4f222a3034cbb","src/canonicalize_and_process.rs":"6dd8e987b160e1dc4584a2fca3120ec681e74cdc121d3606b8cb7687a36ca0ca","src/component.rs":"68b02db2951883b552c116f172fea285e33c12065fa3d8a8aca327d2652cc7bf","src/constructor_parser.rs":"3373e1e4f50fc4876ffb2792893bdf2a1b2f662aa4605ea0f94fa4b900dec837","src/error.rs":"a8ee97b888e5ee8eddcf2e97d98615856d322d211a2cd61a49d5b10fce5c8c16","src/lib.rs":"a94bd6f332978299c7a66e257ca4f8d000a9759a99ef713352caa9a86673a8f9","src/matcher.rs":"609a4d3b50be6233d626f356fd46d61fc7ff06491e966f0fd4d99662a12d1833","src/parser.rs":"fcd913c9f8e8e205df509c1c5c76b9ad0de01214e380203fd37eae52a9f688c6","src/quirks.rs":"715d0381a798635af1c126d866af8873a2a5e6e38d34349e86b6ba87b0c01387","src/regexp.rs":"54800a3c02622e8efa85b9a8888ffd2842cfb211e34fa299e1eac7d0ee66f403","src/testdata/urlpatterntestdata.json":"4cecfe5bb8a9e688235f75e1fad603cfe1b0e87455b1feece858f143c57af0da","src/tokenizer.rs":"af95251846980cceaeea3f61f6a12367525f4299e511b5c3f84dd8f21a355f6b"},"package":"957a88ad1abd5d13336275adb17d4f9b6a2404f3baed2e075e0b026dc0b2b58d"} +\ No newline at end of file diff --git a/third_party/rust/urlpattern/Cargo.lock b/third_party/rust/urlpattern/Cargo.lock @@ -4,9 +4,9 @@ version = 4 [[package]] name = "aho-corasick" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" dependencies = [ "memchr", ] @@ -33,9 +33,9 @@ dependencies = [ [[package]] name = "icu_collections" -version = "2.0.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "200072f5d0e3614556f94a9930d5dc3e0662a652823904c3a75dc3b0af7fee47" +checksum = "4c6b649701667bbe825c3b7e6388cb521c23d88644678e83c0c4d0a621a34b43" dependencies = [ "displaydoc", "potential_utf", @@ -46,9 +46,9 @@ dependencies = [ [[package]] name = "icu_locale_core" -version = "2.0.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cde2700ccaed3872079a65fb1a78f6c0a36c91570f28755dda67bc8f7d9f00a" +checksum = "edba7861004dd3714265b4db54a3c390e880ab658fec5f7db895fae2046b5bb6" dependencies = [ "displaydoc", "litemap", @@ -59,11 +59,10 @@ dependencies = [ [[package]] name = "icu_normalizer" -version = "2.0.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "436880e8e18df4d7bbc06d58432329d6458cc84531f7ac5f024e93deadb37979" +checksum = "5f6c8828b67bf8908d82127b2054ea1b4427ff0230ee9141c54251934ab1b599" dependencies = [ - "displaydoc", "icu_collections", "icu_normalizer_data", "icu_properties", @@ -74,42 +73,38 @@ dependencies = [ [[package]] name = "icu_normalizer_data" -version = "2.0.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00210d6893afc98edb752b664b8890f0ef174c8adbb8d0be9710fa66fbbf72d3" +checksum = "7aedcccd01fc5fe81e6b489c15b247b8b0690feb23304303a9e560f37efc560a" [[package]] name = "icu_properties" -version = "2.0.1" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "016c619c1eeb94efb86809b015c58f479963de65bdb6253345c1a1276f22e32b" +checksum = "e93fcd3157766c0c8da2f8cff6ce651a31f0810eaa1c51ec363ef790bbb5fb99" dependencies = [ - "displaydoc", "icu_collections", "icu_locale_core", "icu_properties_data", "icu_provider", - "potential_utf", "zerotrie", "zerovec", ] [[package]] name = "icu_properties_data" -version = "2.0.1" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "298459143998310acd25ffe6810ed544932242d3f07083eee1084d83a71bd632" +checksum = "02845b3647bb045f1100ecd6480ff52f34c35f82d9880e029d329c21d1054899" [[package]] name = "icu_provider" -version = "2.0.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03c80da27b5f4187909049ee2d72f276f0d9f99a42c306bd0131ecfe04d8e5af" +checksum = "85962cf0ce02e1e0a629cc34e7ca3e373ce20dda4c4d7294bbd0bf1fdb59e614" dependencies = [ "displaydoc", "icu_locale_core", - "stable_deref_trait", - "tinystr", "writeable", "yoke", "zerofrom", @@ -146,15 +141,15 @@ checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" [[package]] name = "litemap" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "241eaef5fd12c88705a01fc1066c48c4b36e0dd4377dcdc7ec3942cea7a69956" +checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77" [[package]] name = "memchr" -version = "2.7.5" +version = "2.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" +checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" [[package]] name = "percent-encoding" @@ -164,36 +159,36 @@ checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" [[package]] name = "potential_utf" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84df19adbe5b5a0782edcab45899906947ab039ccf4573713735ee7de1e6b08a" +checksum = "b73949432f5e2a09657003c25bca5e19a0e9c84f8058ca374f49e0ebe605af77" dependencies = [ "zerovec", ] [[package]] name = "proc-macro2" -version = "1.0.101" +version = "1.0.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" +checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.40" +version = "1.0.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" +checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1" dependencies = [ "proc-macro2", ] [[package]] name = "regex" -version = "1.11.2" +version = "1.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23d7fd106d8c02486a8d64e778353d1cffe08ce79ac2e82f540c86d0facf6912" +checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" dependencies = [ "aho-corasick", "memchr", @@ -203,9 +198,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.10" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b9458fa0bfeeac22b5ca447c63aaf45f28439a709ccd244698632f9aa6394d6" +checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" dependencies = [ "aho-corasick", "memchr", @@ -214,9 +209,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.6" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "caf4aa5b0f434c91fe5c7f1ecb6a5ece2130b02ad2a590589dda5146df959001" +checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" [[package]] name = "ryu" @@ -226,9 +221,9 @@ checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" [[package]] name = "serde" -version = "1.0.225" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd6c24dee235d0da097043389623fb913daddf92c76e9f5a1db88607a0bcbd1d" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" dependencies = [ "serde_core", "serde_derive", @@ -236,18 +231,18 @@ dependencies = [ [[package]] name = "serde_core" -version = "1.0.225" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "659356f9a0cb1e529b24c01e43ad2bdf520ec4ceaf83047b83ddcc2251f96383" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.225" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ea936adf78b1f766949a4977b91d2f5595825bd6ec079aa9543ad2685fc4516" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", @@ -275,15 +270,15 @@ checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" [[package]] name = "stable_deref_trait" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" [[package]] name = "syn" -version = "2.0.106" +version = "2.0.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6" +checksum = "da58917d35242480a05c2897064da0a80589a2a0476c9a3f2fdc83b53502e917" dependencies = [ "proc-macro2", "quote", @@ -303,9 +298,9 @@ dependencies = [ [[package]] name = "tinystr" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d4f6d1145dcb577acf783d4e601bc1d76a13337bb54e6233add580b07344c8b" +checksum = "42d3e9c45c09de15d06dd8acf5f4e0e399e85927b7f00711024eb7ae10fa4869" dependencies = [ "displaydoc", "zerovec", @@ -313,9 +308,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.19" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f63a545481291138910575129486daeaf8ac54aee4387fe7906919f7830c7d9d" +checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" [[package]] name = "url" @@ -331,7 +326,7 @@ dependencies = [ [[package]] name = "urlpattern" -version = "0.4.0" +version = "0.4.1" dependencies = [ "icu_properties", "regex", @@ -348,17 +343,16 @@ checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" [[package]] name = "writeable" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea2f10b9bb0928dfb1b42b65e1f9e36f7f54dbdf08457afefb38afcdec4fa2bb" +checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9" [[package]] name = "yoke" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f41bb01b8226ef4bfd589436a297c53d118f65921786300e427be8d487695cc" +checksum = "72d6e5c6afb84d73944e5cedb052c4680d5657337201555f9f2a16b7406d4954" dependencies = [ - "serde", "stable_deref_trait", "yoke-derive", "zerofrom", @@ -366,9 +360,9 @@ dependencies = [ [[package]] name = "yoke-derive" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38da3c9736e16c5d3c8c597a9aaa5d1fa565d0532ae05e27c24aa62fb32c0ab6" +checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d" dependencies = [ "proc-macro2", "quote", @@ -399,9 +393,9 @@ dependencies = [ [[package]] name = "zerotrie" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36f0bbd478583f79edad978b407914f61b2972f5af6fa089686016be8f9af595" +checksum = "2a59c17a5562d507e4b54960e8569ebee33bee890c70aa3fe7b97e85a9fd7851" dependencies = [ "displaydoc", "yoke", @@ -410,9 +404,9 @@ dependencies = [ [[package]] name = "zerovec" -version = "0.11.4" +version = "0.11.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7aa2bd55086f1ab526693ecbe444205da57e25f4489879da80635a46d90e73b" +checksum = "6c28719294829477f525be0186d13efa9a3c602f7ec202ca9e353d310fb9a002" dependencies = [ "yoke", "zerofrom", @@ -421,9 +415,9 @@ dependencies = [ [[package]] name = "zerovec-derive" -version = "0.11.1" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b96237efa0c878c64bd89c436f661be4e46b2f3eff1ebb976f7ef2321d2f58f" +checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3" dependencies = [ "proc-macro2", "quote", diff --git a/third_party/rust/urlpattern/Cargo.toml b/third_party/rust/urlpattern/Cargo.toml @@ -12,7 +12,7 @@ [package] edition = "2021" name = "urlpattern" -version = "0.4.0" +version = "0.4.1" authors = [ "the Deno authors", "crowlKats <crowlkats@toaxl.com>", diff --git a/third_party/rust/urlpattern/README.md b/third_party/rust/urlpattern/README.md @@ -10,10 +10,6 @@ follow [the specification][spec] as closely as possible. ```rust use urlpattern::UrlPattern; -use urlpattern::UrlPatternInput; -use urlpattern::UrlPatternInit; - -use urlpattern::UrlPattern; use urlpattern::UrlPatternInit; use urlpattern::UrlPatternMatchInput; @@ -23,12 +19,12 @@ fn main() { pathname: Some("/users/:id".to_owned()), ..Default::default() }; - let pattern = <UrlPattern>::parse(init).unwrap(); + let pattern = <UrlPattern>::parse(init, Default::default()).unwrap(); // Match the pattern against a URL. let url = "https://example.com/users/123".parse().unwrap(); let result = pattern.exec(UrlPatternMatchInput::Url(url)).unwrap().unwrap(); - assert_eq!(result.pathname.groups.get("id").unwrap(), "123"); + assert_eq!(result.pathname.groups.get("id").unwrap().as_ref().unwrap(), "123"); } ``` diff --git a/third_party/rust/urlpattern/src/component.rs b/third_party/rust/urlpattern/src/component.rs @@ -232,7 +232,7 @@ fn generate_pattern_string(part_list: &[&Part], options: &Options) -> String { kind: PartType::FixedText, value, .. - }) if value.chars().last().unwrap().to_string() == options.prefix_code_point + }) if !value.is_empty() && value.chars().last().unwrap().to_string() == options.prefix_code_point ) { needs_grouping = true; diff --git a/third_party/rust/urlpattern/src/lib.rs b/third_party/rust/urlpattern/src/lib.rs @@ -1120,4 +1120,16 @@ mod tests { // Should use non-opaque canonicalization because of leading slash assert_eq!(myfile_pattern.pathname().to_string(), "/test"); } + + #[test] + fn issue72() { + let _ = <UrlPattern>::parse( + UrlPatternInit { + pathname: Some("\\\n*\0".to_string()), + ..Default::default() + }, + Default::default(), + ) + .unwrap(); + } } diff --git a/third_party/rust/urlpattern/src/regexp.rs b/third_party/rust/urlpattern/src/regexp.rs @@ -22,8 +22,8 @@ impl RegExp for regex::Regex { RegexSyntax::Rust } - fn parse(pattern: &str, flags: &str, _force_eval: bool) -> Result<Self, ()> { - regex::Regex::new(&format!("(?{flags}){pattern}")).map_err(|_| ()) + fn parse(pattern: &str, _flags: &str, _force_eval: bool) -> Result<Self, ()> { + regex::Regex::new(pattern).map_err(|_| ()) } fn matches<'a>(&self, text: &'a str) -> Option<Vec<Option<&'a str>>> { diff --git a/third_party/rust/urlpattern/src/testdata/urlpatterntestdata.json b/third_party/rust/urlpattern/src/testdata/urlpatterntestdata.json @@ -60,26 +60,26 @@ { "pattern": [{ "pathname": "/foo/bar" }], "inputs": [{ "pathname": "/foo/bar/baz", - "baseURL": "https://example.com" }], + "baseURL": "https://example.com" }], "expected_match": null }, { "pattern": [{ "pathname": "/foo/bar", - "baseURL": "https://example.com?query#hash" }], + "baseURL": "https://example.com?query#hash" }], "inputs": [{ "pathname": "/foo/bar" }], "expected_match": null }, { "pattern": [{ "pathname": "/foo/bar", - "baseURL": "https://example.com?query#hash" }], + "baseURL": "https://example.com?query#hash" }], "inputs": [{ "hostname": "example.com", "pathname": "/foo/bar" }], "expected_match": null }, { "pattern": [{ "pathname": "/foo/bar", - "baseURL": "https://example.com?query#hash" }], + "baseURL": "https://example.com?query#hash" }], "inputs": [{ "protocol": "https", "hostname": "example.com", - "pathname": "/foo/bar" }], + "pathname": "/foo/bar" }], "exactly_empty_components": [ "port" ], "expected_match": { "hostname": { "input": "example.com", "groups": {} }, @@ -89,9 +89,9 @@ }, { "pattern": [{ "pathname": "/foo/bar", - "baseURL": "https://example.com" }], + "baseURL": "https://example.com" }], "inputs": [{ "protocol": "https", "hostname": "example.com", - "pathname": "/foo/bar" }], + "pathname": "/foo/bar" }], "exactly_empty_components": [ "port" ], "expected_match": { "hostname": { "input": "example.com", "groups": {} }, @@ -101,17 +101,17 @@ }, { "pattern": [{ "pathname": "/foo/bar", - "baseURL": "https://example.com" }], + "baseURL": "https://example.com" }], "inputs": [{ "protocol": "https", "hostname": "example.com", - "pathname": "/foo/bar/baz" }], + "pathname": "/foo/bar/baz" }], "expected_match": null }, { "pattern": [{ "pathname": "/foo/bar", - "baseURL": "https://example.com?query#hash" }], + "baseURL": "https://example.com?query#hash" }], "inputs": [{ "protocol": "https", "hostname": "example.com", - "pathname": "/foo/bar", "search": "otherquery", - "hash": "otherhash" }], + "pathname": "/foo/bar", "search": "otherquery", + "hash": "otherhash" }], "exactly_empty_components": [ "port" ], "expected_match": { "hash": { "input": "otherhash", "groups": { "0": "otherhash" } }, @@ -123,10 +123,10 @@ }, { "pattern": [{ "pathname": "/foo/bar", - "baseURL": "https://example.com" }], + "baseURL": "https://example.com" }], "inputs": [{ "protocol": "https", "hostname": "example.com", - "pathname": "/foo/bar", "search": "otherquery", - "hash": "otherhash" }], + "pathname": "/foo/bar", "search": "otherquery", + "hash": "otherhash" }], "exactly_empty_components": [ "port" ], "expected_match": { "hash": { "input": "otherhash", "groups": { "0": "otherhash" } }, @@ -138,10 +138,10 @@ }, { "pattern": [{ "pathname": "/foo/bar", - "baseURL": "https://example.com?otherquery#otherhash" }], + "baseURL": "https://example.com?otherquery#otherhash" }], "inputs": [{ "protocol": "https", "hostname": "example.com", - "pathname": "/foo/bar", "search": "otherquery", - "hash": "otherhash" }], + "pathname": "/foo/bar", "search": "otherquery", + "hash": "otherhash" }], "exactly_empty_components": [ "port" ], "expected_match": { "hash": { "input": "otherhash", "groups": { "0": "otherhash" } }, @@ -153,7 +153,7 @@ }, { "pattern": [{ "pathname": "/foo/bar", - "baseURL": "https://example.com?query#hash" }], + "baseURL": "https://example.com?query#hash" }], "inputs": [ "https://example.com/foo/bar" ], "exactly_empty_components": [ "port" ], "expected_match": { @@ -164,7 +164,7 @@ }, { "pattern": [{ "pathname": "/foo/bar", - "baseURL": "https://example.com?query#hash" }], + "baseURL": "https://example.com?query#hash" }], "inputs": [ "https://example.com/foo/bar?otherquery#otherhash" ], "exactly_empty_components": [ "port" ], "expected_match": { @@ -177,7 +177,7 @@ }, { "pattern": [{ "pathname": "/foo/bar", - "baseURL": "https://example.com?query#hash" }], + "baseURL": "https://example.com?query#hash" }], "inputs": [ "https://example.com/foo/bar?query#hash" ], "exactly_empty_components": [ "port" ], "expected_match": { @@ -190,25 +190,25 @@ }, { "pattern": [{ "pathname": "/foo/bar", - "baseURL": "https://example.com?query#hash" }], + "baseURL": "https://example.com?query#hash" }], "inputs": [ "https://example.com/foo/bar/baz" ], "expected_match": null }, { "pattern": [{ "pathname": "/foo/bar", - "baseURL": "https://example.com?query#hash" }], + "baseURL": "https://example.com?query#hash" }], "inputs": [ "https://other.com/foo/bar" ], "expected_match": null }, { "pattern": [{ "pathname": "/foo/bar", - "baseURL": "https://example.com?query#hash" }], + "baseURL": "https://example.com?query#hash" }], "inputs": [ "http://other.com/foo/bar" ], "expected_match": null }, { "pattern": [{ "pathname": "/foo/bar", - "baseURL": "https://example.com?query#hash" }], + "baseURL": "https://example.com?query#hash" }], "inputs": [{ "pathname": "/foo/bar", "baseURL": "https://example.com" }], "exactly_empty_components": [ "port" ], "expected_match": { @@ -219,9 +219,9 @@ }, { "pattern": [{ "pathname": "/foo/bar", - "baseURL": "https://example.com?query#hash" }], + "baseURL": "https://example.com?query#hash" }], "inputs": [{ "pathname": "/foo/bar", - "baseURL": "https://example.com?query#hash" }], + "baseURL": "https://example.com?query#hash" }], "exactly_empty_components": [ "port" ], "expected_match": { "hostname": { "input": "example.com", "groups": {} }, @@ -231,20 +231,20 @@ }, { "pattern": [{ "pathname": "/foo/bar", - "baseURL": "https://example.com?query#hash" }], + "baseURL": "https://example.com?query#hash" }], "inputs": [{ "pathname": "/foo/bar/baz", - "baseURL": "https://example.com" }], + "baseURL": "https://example.com" }], "expected_match": null }, { "pattern": [{ "pathname": "/foo/bar", - "baseURL": "https://example.com?query#hash" }], + "baseURL": "https://example.com?query#hash" }], "inputs": [{ "pathname": "/foo/bar", "baseURL": "https://other.com" }], "expected_match": null }, { "pattern": [{ "pathname": "/foo/bar", - "baseURL": "https://example.com?query#hash" }], + "baseURL": "https://example.com?query#hash" }], "inputs": [{ "pathname": "/foo/bar", "baseURL": "http://example.com" }], "expected_match": null }, @@ -1556,7 +1556,7 @@ { "pattern": [ "https://example.com:8080/foo?bar#baz" ], "inputs": [{ "pathname": "/foo", "search": "bar", "hash": "baz", - "baseURL": "https://example.com:8080" }], + "baseURL": "https://example.com:8080" }], "expected_obj": { "protocol": "https", "username": "*", @@ -1579,7 +1579,7 @@ { "pattern": [ "/foo?bar#baz", "https://example.com:8080" ], "inputs": [{ "pathname": "/foo", "search": "bar", "hash": "baz", - "baseURL": "https://example.com:8080" }], + "baseURL": "https://example.com:8080" }], "expected_obj": { "pathname": "/foo", "search": "bar", @@ -1615,7 +1615,7 @@ "protocol": { "input": "https", "groups": {} }, "hostname": { "input": "sub.example.com", "groups": { "0": "sub" } }, "pathname": { "input": "/foo/bar", "groups": { "product": "foo", - "endpoint": "bar" } } + "endpoint": "bar" } } } }, { @@ -1994,9 +1994,9 @@ { "pattern": [ "https://example.com/foo?bar#baz" ], "inputs": [{ "protocol": "https:", - "search": "?bar", - "hash": "#baz", - "baseURL": "http://example.com/foo" }], + "search": "?bar", + "hash": "#baz", + "baseURL": "http://example.com/foo" }], "exactly_empty_components": [ "port" ], "expected_obj": { "protocol": "https", @@ -2009,8 +2009,8 @@ }, { "pattern": [{ "protocol": "http{s}?:", - "search": "?bar", - "hash": "#baz" }], + "search": "?bar", + "hash": "#baz" }], "inputs": [ "http://example.com/foo?bar#baz" ], "expected_obj": { "protocol": "http{s}?", @@ -2855,9 +2855,9 @@ }, { "pattern": [ "https://example.com:8080/foo?bar#baz", - { "ignoreCase": true }], + { "ignoreCase": true }], "inputs": [{ "pathname": "/FOO", "search": "BAR", "hash": "BAZ", - "baseURL": "https://example.com:8080" }], + "baseURL": "https://example.com:8080" }], "expected_obj": { "protocol": "https", "hostname": "example.com", @@ -2877,9 +2877,9 @@ }, { "pattern": [ "/foo?bar#baz", "https://example.com:8080", - { "ignoreCase": true }], + { "ignoreCase": true }], "inputs": [{ "pathname": "/FOO", "search": "BAR", "hash": "BAZ", - "baseURL": "https://example.com:8080" }], + "baseURL": "https://example.com:8080" }], "expected_obj": { "protocol": "https", "hostname": "example.com", @@ -2899,9 +2899,9 @@ }, { "pattern": [ "/foo?bar#baz", { "ignoreCase": true }, - "https://example.com:8080" ], + "https://example.com:8080" ], "inputs": [{ "pathname": "/FOO", "search": "BAR", "hash": "BAZ", - "baseURL": "https://example.com:8080" }], + "baseURL": "https://example.com:8080" }], "expected_obj": "error" }, { @@ -2961,7 +2961,7 @@ "pathname": { "input": "/z", "groups": { "0": "z" } } } }, - { + { "pattern": [{ "pathname": "/([\\d&&[0-1]])" }], "inputs": [{ "pathname": "/0" }], "expected_match": { @@ -2972,5 +2972,47 @@ "pattern": [{ "pathname": "/([\\d&&[0-1]])" }], "inputs": [{ "pathname": "/3" }], "expected_match": null + }, + { + "pattern": [{ "protocol": "http", "hostname": "example.com/ignoredpath" }], + "inputs": ["http://example.com/"], + "expected_obj": { + "protocol": "http", + "hostname": "example.com", + "pathname": "*" + }, + "expected_match": { + "protocol": { "input": "http", "groups": {} }, + "hostname": { "input": "example.com", "groups": {} }, + "pathname": { "input": "/", "groups": { "0": "/" } } + } + }, + { + "pattern": [{ "protocol": "http", "hostname": "example.com\\?ignoredsearch" }], + "inputs": ["http://example.com/"], + "expected_obj": { + "protocol": "http", + "hostname": "example.com", + "search": "*" + }, + "expected_match": { + "protocol": { "input": "http", "groups": {} }, + "hostname": { "input": "example.com", "groups": {} }, + "pathname": { "input": "/", "groups": { "0": "/" } } + } + }, + { + "pattern": [{ "protocol": "http", "hostname": "example.com#ignoredhash" }], + "inputs": ["http://example.com/"], + "expected_obj": { + "protocol": "http", + "hostname": "example.com", + "hash": "*" + }, + "expected_match": { + "protocol": { "input": "http", "groups": {} }, + "hostname": { "input": "example.com", "groups": {} }, + "pathname": { "input": "/", "groups": { "0": "/" } } + } } ] diff --git a/toolkit/library/rust/shared/Cargo.toml b/toolkit/library/rust/shared/Cargo.toml @@ -110,7 +110,7 @@ aa-stroke = { git = "https://github.com/FirefoxGraphics/aa-stroke", rev = "a821f etagere = { version = "0.2.13", features = ["ffi"] } url = "2.5.7" -urlpattern = "0.4.0" +urlpattern = "0.4.1" urlpattern_glue = { path = "../../../../netwerk/base/urlpattern_glue" } uritemplate_glue = { path = "../../../../netwerk/base/uritemplate_glue" }