diff --git a/Cargo.lock b/Cargo.lock index 0d5c46953f3967..b81fa0539c2a78 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4223,9 +4223,9 @@ checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" [[package]] name = "form_urlencoded" -version = "1.2.1" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" dependencies = [ "percent-encoding", ] @@ -5188,7 +5188,7 @@ dependencies = [ "displaydoc", "icu_collections 1.5.0", "icu_normalizer_data", - "icu_properties", + "icu_properties 1.5.1", "icu_provider 1.5.0", "smallvec", "utf16_iter", @@ -5212,18 +5212,38 @@ dependencies = [ "displaydoc", "icu_collections 1.5.0", "icu_locid_transform", - "icu_properties_data", + "icu_properties_data 1.5.0", "icu_provider 1.5.0", "tinystr 0.7.6", "zerovec 0.10.4", ] +[[package]] +name = "icu_properties" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e93fcd3157766c0c8da2f8cff6ce651a31f0810eaa1c51ec363ef790bbb5fb99" +dependencies = [ + "icu_collections 2.1.1", + "icu_locale_core", + "icu_properties_data 2.1.1", + "icu_provider 2.1.1", + "zerotrie", + "zerovec 0.11.4", +] + [[package]] name = "icu_properties_data" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" +[[package]] +name = "icu_properties_data" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02845b3647bb045f1100ecd6480ff52f34c35f82d9880e029d329c21d1054899" + [[package]] name = "icu_provider" version = "1.5.0" @@ -5277,9 +5297,9 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "idna" -version = "1.0.3" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" dependencies = [ "idna_adapter", "smallvec", @@ -5293,7 +5313,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" dependencies = [ "icu_normalizer", - "icu_properties", + "icu_properties 1.5.1", ] [[package]] @@ -6836,9 +6856,9 @@ dependencies = [ [[package]] name = "percent-encoding" -version = "2.3.1" +version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" [[package]] name = "pest" @@ -9906,47 +9926,6 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" -[[package]] -name = "unic-char-property" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8c57a407d9b6fa02b4795eb81c5b6652060a15a7903ea981f3d723e6c0be221" -dependencies = [ - "unic-char-range", -] - -[[package]] -name = "unic-char-range" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0398022d5f700414f6b899e10b8348231abf9173fa93144cbc1a43b9793c1fbc" - -[[package]] -name = "unic-common" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80d7ff825a6a654ee85a63e80f92f054f904f21e7d12da4e22f9834a4aaa35bc" - -[[package]] -name = "unic-ucd-ident" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e230a37c0381caa9219d67cf063aa3a375ffed5bf541a452db16e744bdab6987" -dependencies = [ - "unic-char-property", - "unic-char-range", - "unic-ucd-version", -] - -[[package]] -name = "unic-ucd-version" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96bd2f2237fe450fcd0a1d2f5f4e91711124f7857ba2e964247776ebeeb7b0c4" -dependencies = [ - "unic-common", -] - [[package]] name = "unicase" version = "2.7.0" @@ -10031,9 +10010,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.5.4" +version = "2.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" +checksum = "08bc136a29a3d1758e07a9cca267be308aeebf5cfd5a10f3f67ab2097683ef5b" dependencies = [ "form_urlencoded", "idna", @@ -10043,13 +10022,13 @@ dependencies = [ [[package]] name = "urlpattern" -version = "0.3.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70acd30e3aa1450bc2eece896ce2ad0d178e9c079493819301573dae3c37ba6d" +checksum = "957a88ad1abd5d13336275adb17d4f9b6a2404f3baed2e075e0b026dc0b2b58d" dependencies = [ + "icu_properties 2.1.1", "regex", "serde", - "unic-ucd-ident", "url", ] @@ -11211,6 +11190,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "36f0bbd478583f79edad978b407914f61b2972f5af6fa089686016be8f9af595" dependencies = [ "displaydoc", + "yoke 0.8.0", + "zerofrom", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index a7a419e9ef9d9b..acdc1d5122ee49 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -272,7 +272,7 @@ tracing-subscriber = "0.3.20" twox-hash = { version = "=2.1.0", features = ["std", "xxhash64"], default-features = false } typed-arena = "=2.0.2" url = { version = "2.5", features = ["serde", "expose_internals"] } -urlpattern = "0.3.0" +urlpattern = "=0.4.1" uuid = { version = "1.3.0", features = ["v4"] } walkdir = "=2.5.0" weak-table = "0.3.2" diff --git a/ext/web/01_urlpattern.js b/ext/web/01_urlpattern.js index a5c752e4b8116f..08b6598d2c35b8 100644 --- a/ext/web/01_urlpattern.js +++ b/ext/web/01_urlpattern.js @@ -182,7 +182,7 @@ class URLPattern { input = { __proto__: null }; } options = webidl.converters.URLPatternOptions( - maybeOptions, + baseURLOrOptions, prefix, "Argument 2", ); diff --git a/tests/unit/urlpattern_test.ts b/tests/unit/urlpattern_test.ts index 4d815cd04209c5..a78ab7d7d28022 100644 --- a/tests/unit/urlpattern_test.ts +++ b/tests/unit/urlpattern_test.ts @@ -63,3 +63,13 @@ Deno.test(function urlPatternWithPrototypePollution() { RegExp.prototype.exec = originalExec; } }); + +Deno.test(function urlPatternFlagsRegression() { + new URLPattern({ pathname: "/install(\.sh|\.ps1)" }); +}); + +Deno.test(function urlPatternIgnoreCase() { + const p = new URLPattern({ pathname: "/test" }, { ignoreCase: true }); + assert(p.test("/test", "http://localhost")); + assert(p.test("/TeSt", "http://localhost")); +}); diff --git a/tests/wpt/runner/expectation.json b/tests/wpt/runner/expectation.json index fd747974113cc5..3c62447d2e5383 100644 --- a/tests/wpt/runner/expectation.json +++ b/tests/wpt/runner/expectation.json @@ -15438,22 +15438,7 @@ "urlpattern.any.html": [ "Pattern: [{\"pathname\":\"\\ud83d \\udeb2\"}] Inputs: []", "Pattern: [{\"pathname\":\":a󠄀b\"}] Inputs: []", - "Pattern: [{\"protocol\":\"http\",\"port\":\"80 \"}] Inputs: [{\"protocol\":\"http\",\"port\":\"80\"}]", - "Pattern: [{\"port\":\"80\"}] Inputs: [{\"port\":\"8\\t0\"}]", - "Pattern: [{\"port\":\"80\"}] Inputs: [{\"port\":\"80x\"}]", - "Pattern: [{\"port\":\"80\"}] Inputs: [{\"port\":\"80?x\"}]", - "Pattern: [{\"port\":\"80\"}] Inputs: [{\"port\":\"80\\\\x\"}]", - "Pattern: [\"https://{sub.}?example{.com/}foo\"] Inputs: [\"https://example.com/foo\"]", - "Pattern: [{\"hostname\":\"bad#hostname\"}] Inputs: [{\"hostname\":\"bad\"}]", - "Pattern: [{\"hostname\":\"bad/hostname\"}] Inputs: [{\"hostname\":\"bad\"}]", - "Pattern: [{\"hostname\":\"bad\\\\:hostname\"}] Inputs: undefined", - "Pattern: [{\"hostname\":\"bad\\\\\\\\hostname\"}] Inputs: [{\"hostname\":\"badhostname\"}]", - "Pattern: [{\"hostname\":\"bad\\nhostname\"}] Inputs: [{\"hostname\":\"badhostname\"}]", - "Pattern: [{\"hostname\":\"bad\\rhostname\"}] Inputs: [{\"hostname\":\"badhostname\"}]", - "Pattern: [{\"hostname\":\"bad\\thostname\"}] Inputs: [{\"hostname\":\"badhostname\"}]", "Pattern: [] Inputs: []", - "Pattern: [{\"pathname\":\"/foo/bar\"},{\"ignoreCase\":true}] Inputs: [{\"pathname\":\"/FOO/BAR\"}]", - "Pattern: [\"https://example.com:8080/foo?bar#baz\",{\"ignoreCase\":true}] Inputs: [{\"pathname\":\"/FOO\",\"search\":\"BAR\",\"hash\":\"BAZ\",\"baseURL\":\"https://example.com:8080\"}]", "Pattern: [{\"pathname\":\"/([[a-z]--a])\"}] Inputs: [{\"pathname\":\"/a\"}]", "Pattern: [{\"pathname\":\"/([[a-z]--a])\"}] Inputs: [{\"pathname\":\"/z\"}]", "Pattern: [{\"pathname\":\"/([\\\\d&&[0-1]])\"}] Inputs: [{\"pathname\":\"/0\"}]", @@ -15462,22 +15447,7 @@ "urlpattern.any.worker.html": [ "Pattern: [{\"pathname\":\"\\ud83d \\udeb2\"}] Inputs: []", "Pattern: [{\"pathname\":\":a󠄀b\"}] Inputs: []", - "Pattern: [{\"protocol\":\"http\",\"port\":\"80 \"}] Inputs: [{\"protocol\":\"http\",\"port\":\"80\"}]", - "Pattern: [{\"port\":\"80\"}] Inputs: [{\"port\":\"8\\t0\"}]", - "Pattern: [{\"port\":\"80\"}] Inputs: [{\"port\":\"80x\"}]", - "Pattern: [{\"port\":\"80\"}] Inputs: [{\"port\":\"80?x\"}]", - "Pattern: [{\"port\":\"80\"}] Inputs: [{\"port\":\"80\\\\x\"}]", - "Pattern: [\"https://{sub.}?example{.com/}foo\"] Inputs: [\"https://example.com/foo\"]", - "Pattern: [{\"hostname\":\"bad#hostname\"}] Inputs: [{\"hostname\":\"bad\"}]", - "Pattern: [{\"hostname\":\"bad/hostname\"}] Inputs: [{\"hostname\":\"bad\"}]", - "Pattern: [{\"hostname\":\"bad\\\\:hostname\"}] Inputs: undefined", - "Pattern: [{\"hostname\":\"bad\\\\\\\\hostname\"}] Inputs: [{\"hostname\":\"badhostname\"}]", - "Pattern: [{\"hostname\":\"bad\\nhostname\"}] Inputs: [{\"hostname\":\"badhostname\"}]", - "Pattern: [{\"hostname\":\"bad\\rhostname\"}] Inputs: [{\"hostname\":\"badhostname\"}]", - "Pattern: [{\"hostname\":\"bad\\thostname\"}] Inputs: [{\"hostname\":\"badhostname\"}]", "Pattern: [] Inputs: []", - "Pattern: [{\"pathname\":\"/foo/bar\"},{\"ignoreCase\":true}] Inputs: [{\"pathname\":\"/FOO/BAR\"}]", - "Pattern: [\"https://example.com:8080/foo?bar#baz\",{\"ignoreCase\":true}] Inputs: [{\"pathname\":\"/FOO\",\"search\":\"BAR\",\"hash\":\"BAZ\",\"baseURL\":\"https://example.com:8080\"}]", "Pattern: [{\"pathname\":\"/([[a-z]--a])\"}] Inputs: [{\"pathname\":\"/a\"}]", "Pattern: [{\"pathname\":\"/([[a-z]--a])\"}] Inputs: [{\"pathname\":\"/z\"}]", "Pattern: [{\"pathname\":\"/([\\\\d&&[0-1]])\"}] Inputs: [{\"pathname\":\"/0\"}]", @@ -15486,22 +15456,7 @@ "urlpattern.https.any.html": [ "Pattern: [{\"pathname\":\"\\ud83d \\udeb2\"}] Inputs: []", "Pattern: [{\"pathname\":\":a󠄀b\"}] Inputs: []", - "Pattern: [{\"protocol\":\"http\",\"port\":\"80 \"}] Inputs: [{\"protocol\":\"http\",\"port\":\"80\"}]", - "Pattern: [{\"port\":\"80\"}] Inputs: [{\"port\":\"8\\t0\"}]", - "Pattern: [{\"port\":\"80\"}] Inputs: [{\"port\":\"80x\"}]", - "Pattern: [{\"port\":\"80\"}] Inputs: [{\"port\":\"80?x\"}]", - "Pattern: [{\"port\":\"80\"}] Inputs: [{\"port\":\"80\\\\x\"}]", - "Pattern: [\"https://{sub.}?example{.com/}foo\"] Inputs: [\"https://example.com/foo\"]", - "Pattern: [{\"hostname\":\"bad#hostname\"}] Inputs: [{\"hostname\":\"bad\"}]", - "Pattern: [{\"hostname\":\"bad/hostname\"}] Inputs: [{\"hostname\":\"bad\"}]", - "Pattern: [{\"hostname\":\"bad\\\\:hostname\"}] Inputs: undefined", - "Pattern: [{\"hostname\":\"bad\\\\\\\\hostname\"}] Inputs: [{\"hostname\":\"badhostname\"}]", - "Pattern: [{\"hostname\":\"bad\\nhostname\"}] Inputs: [{\"hostname\":\"badhostname\"}]", - "Pattern: [{\"hostname\":\"bad\\rhostname\"}] Inputs: [{\"hostname\":\"badhostname\"}]", - "Pattern: [{\"hostname\":\"bad\\thostname\"}] Inputs: [{\"hostname\":\"badhostname\"}]", "Pattern: [] Inputs: []", - "Pattern: [{\"pathname\":\"/foo/bar\"},{\"ignoreCase\":true}] Inputs: [{\"pathname\":\"/FOO/BAR\"}]", - "Pattern: [\"https://example.com:8080/foo?bar#baz\",{\"ignoreCase\":true}] Inputs: [{\"pathname\":\"/FOO\",\"search\":\"BAR\",\"hash\":\"BAZ\",\"baseURL\":\"https://example.com:8080\"}]", "Pattern: [{\"pathname\":\"/([[a-z]--a])\"}] Inputs: [{\"pathname\":\"/a\"}]", "Pattern: [{\"pathname\":\"/([[a-z]--a])\"}] Inputs: [{\"pathname\":\"/z\"}]", "Pattern: [{\"pathname\":\"/([\\\\d&&[0-1]])\"}] Inputs: [{\"pathname\":\"/0\"}]", @@ -15510,22 +15465,7 @@ "urlpattern.https.any.worker.html": [ "Pattern: [{\"pathname\":\"\\ud83d \\udeb2\"}] Inputs: []", "Pattern: [{\"pathname\":\":a󠄀b\"}] Inputs: []", - "Pattern: [{\"protocol\":\"http\",\"port\":\"80 \"}] Inputs: [{\"protocol\":\"http\",\"port\":\"80\"}]", - "Pattern: [{\"port\":\"80\"}] Inputs: [{\"port\":\"8\\t0\"}]", - "Pattern: [{\"port\":\"80\"}] Inputs: [{\"port\":\"80x\"}]", - "Pattern: [{\"port\":\"80\"}] Inputs: [{\"port\":\"80?x\"}]", - "Pattern: [{\"port\":\"80\"}] Inputs: [{\"port\":\"80\\\\x\"}]", - "Pattern: [\"https://{sub.}?example{.com/}foo\"] Inputs: [\"https://example.com/foo\"]", - "Pattern: [{\"hostname\":\"bad#hostname\"}] Inputs: [{\"hostname\":\"bad\"}]", - "Pattern: [{\"hostname\":\"bad/hostname\"}] Inputs: [{\"hostname\":\"bad\"}]", - "Pattern: [{\"hostname\":\"bad\\\\:hostname\"}] Inputs: undefined", - "Pattern: [{\"hostname\":\"bad\\\\\\\\hostname\"}] Inputs: [{\"hostname\":\"badhostname\"}]", - "Pattern: [{\"hostname\":\"bad\\nhostname\"}] Inputs: [{\"hostname\":\"badhostname\"}]", - "Pattern: [{\"hostname\":\"bad\\rhostname\"}] Inputs: [{\"hostname\":\"badhostname\"}]", - "Pattern: [{\"hostname\":\"bad\\thostname\"}] Inputs: [{\"hostname\":\"badhostname\"}]", "Pattern: [] Inputs: []", - "Pattern: [{\"pathname\":\"/foo/bar\"},{\"ignoreCase\":true}] Inputs: [{\"pathname\":\"/FOO/BAR\"}]", - "Pattern: [\"https://example.com:8080/foo?bar#baz\",{\"ignoreCase\":true}] Inputs: [{\"pathname\":\"/FOO\",\"search\":\"BAR\",\"hash\":\"BAZ\",\"baseURL\":\"https://example.com:8080\"}]", "Pattern: [{\"pathname\":\"/([[a-z]--a])\"}] Inputs: [{\"pathname\":\"/a\"}]", "Pattern: [{\"pathname\":\"/([[a-z]--a])\"}] Inputs: [{\"pathname\":\"/z\"}]", "Pattern: [{\"pathname\":\"/([\\\\d&&[0-1]])\"}] Inputs: [{\"pathname\":\"/0\"}]",