| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 8cb3441 commit 99f93af
15 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -264,7 +264,7 @@ void URLPattern::New(const FunctionCallbackInfo<Value>& args) { | |||
| 264 | 264 | } | |
| 265 | 265 | ||
| 266 | 266 | auto url_pattern = parse_url_pattern<URLPatternRegexProvider>( | |
| 267 | - arg0, | ||
| 267 | + std::move(arg0), | ||
| 268 | 268 | base_url ? &base_url_view : nullptr, | |
| 269 | 269 | options.has_value() ? &options.value() : nullptr); | |
| 270 | 270 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -28,8 +28,8 @@ Last update: | |||
| 28 | 28 | - resource-timing: https://github.com/web-platform-tests/wpt/tree/22d38586d0/resource-timing | |
| 29 | 29 | - resources: https://github.com/web-platform-tests/wpt/tree/1e140d63ec/resources | |
| 30 | 30 | - streams: https://github.com/web-platform-tests/wpt/tree/bc9dcbbf1a/streams | |
| 31 | - - url: https://github.com/web-platform-tests/wpt/tree/a23788b77a/url | ||
| 32 | - - urlpattern: https://github.com/web-platform-tests/wpt/tree/3b6b19853a/urlpattern | ||
| 31 | + - url: https://github.com/web-platform-tests/wpt/tree/d86fcc9e87/url | ||
| 32 | + - urlpattern: https://github.com/web-platform-tests/wpt/tree/827d52cc6e/urlpattern | ||
| 33 | 33 | - user-timing: https://github.com/web-platform-tests/wpt/tree/5ae85bf826/user-timing | |
| 34 | 34 | - wasm/jsapi: https://github.com/web-platform-tests/wpt/tree/cde25e7e3c/wasm/jsapi | |
| 35 | 35 | - wasm/webapi: https://github.com/web-platform-tests/wpt/tree/fd1b23eeaa/wasm/webapi | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,19 +1,5 @@ | |||
| 1 | 1 | promise_test(() => fetch("resources/IdnaTestV2.json").then(res => res.json()).then(runTests), "Loading data…"); | |
| 2 | 2 | ||
| 3 | - // Performance impact of this seems negligible (performance.now() diff in WebKit went from 48 to 52) | ||
| 4 | - // and there was a preference to let more non-ASCII hit the parser. | ||
| 5 | - function encodeHostEndingCodePoints(input) { | ||
| 6 | - let output = ""; | ||
| 7 | - for (const codePoint of input) { | ||
| 8 | - if ([":", "/", "?", "#", "\\"].includes(codePoint)) { | ||
| 9 | - output += encodeURIComponent(codePoint); | ||
| 10 | - } else { | ||
| 11 | - output += codePoint; | ||
| 12 | - } | ||
| 13 | - } | ||
| 14 | - return output; | ||
| 15 | - } | ||
| 16 | - | ||
| 17 | 3 | function runTests(idnaTests) { | |
| 18 | 4 | for (const idnaTest of idnaTests) { | |
| 19 | 5 | if (typeof idnaTest === "string") { | |
@@ -22,15 +8,12 @@ function runTests(idnaTests) { | |||
| 22 | 8 | if (idnaTest.input === "") { | |
| 23 | 9 | continue // cannot test empty string input through new URL() | |
| 24 | 10 | } | |
| 25 | - // Percent-encode the input such that ? and equivalent code points do not end up counting as | ||
| 26 | - // part of the URL, but are parsed through the host parser instead. | ||
| 27 | - const encodedInput = encodeHostEndingCodePoints(idnaTest.input); | ||
| 28 | 11 | ||
| 29 | 12 | test(() => { | |
| 30 | 13 | if (idnaTest.output === null) { | |
| 31 | - assert_throws_js(TypeError, () => new URL(`https://${encodedInput}/x`)); | ||
| 14 | + assert_throws_js(TypeError, () => new URL(`https://${idnaTest.input}/x`)); | ||
| 32 | 15 | } else { | |
| 33 | - const url = new URL(`https://${encodedInput}/x`); | ||
| 16 | + const url = new URL(`https://${idnaTest.input}/x`); | ||
| 34 | 17 | assert_equals(url.host, idnaTest.output); | |
| 35 | 18 | assert_equals(url.hostname, idnaTest.output); | |
| 36 | 19 | assert_equals(url.pathname, "/x"); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1141,6 +1141,42 @@ | |||
| 1141 | 1141 | "host": "example.com", | |
| 1142 | 1142 | "hostname": "example.com" | |
| 1143 | 1143 | } | |
| 1144 | + }, | ||
| 1145 | + { | ||
| 1146 | + "href": "https://test.invalid/", | ||
| 1147 | + "new_value": "*", | ||
| 1148 | + "expected": { | ||
| 1149 | + "href": "https://*/", | ||
| 1150 | + "host": "*", | ||
| 1151 | + "hostname": "*" | ||
| 1152 | + } | ||
| 1153 | + }, | ||
| 1154 | + { | ||
| 1155 | + "href": "https://test.invalid/", | ||
| 1156 | + "new_value": "x@x", | ||
| 1157 | + "expected": { | ||
| 1158 | + "href": "https://test.invalid/", | ||
| 1159 | + "host": "test.invalid", | ||
| 1160 | + "hostname": "test.invalid" | ||
| 1161 | + } | ||
| 1162 | + }, | ||
| 1163 | + { | ||
| 1164 | + "href": "https://test.invalid/", | ||
| 1165 | + "new_value": "foo\t\r\nbar", | ||
| 1166 | + "expected": { | ||
| 1167 | + "href": "https://foobar/", | ||
| 1168 | + "host": "foobar", | ||
| 1169 | + "hostname": "foobar" | ||
| 1170 | + } | ||
| 1171 | + }, | ||
| 1172 | + { | ||
| 1173 | + "href": "https://test.invalid/", | ||
| 1174 | + "new_value": "><", | ||
| 1175 | + "expected": { | ||
| 1176 | + "href": "https://test.invalid/", | ||
| 1177 | + "host": "test.invalid", | ||
| 1178 | + "hostname": "test.invalid" | ||
| 1179 | + } | ||
| 1144 | 1180 | } | |
| 1145 | 1181 | ], | |
| 1146 | 1182 | "hostname": [ | |
@@ -1552,6 +1588,42 @@ | |||
| 1552 | 1588 | "host": "example.com", | |
| 1553 | 1589 | "hostname": "example.com" | |
| 1554 | 1590 | } | |
| 1591 | + }, | ||
| 1592 | + { | ||
| 1593 | + "href": "https://test.invalid/", | ||
| 1594 | + "new_value": "*", | ||
| 1595 | + "expected": { | ||
| 1596 | + "href": "https://*/", | ||
| 1597 | + "host": "*", | ||
| 1598 | + "hostname": "*" | ||
| 1599 | + } | ||
| 1600 | + }, | ||
| 1601 | + { | ||
| 1602 | + "href": "https://test.invalid/", | ||
| 1603 | + "new_value": "x@x", | ||
| 1604 | + "expected": { | ||
| 1605 | + "href": "https://test.invalid/", | ||
| 1606 | + "host": "test.invalid", | ||
| 1607 | + "hostname": "test.invalid" | ||
| 1608 | + } | ||
| 1609 | + }, | ||
| 1610 | + { | ||
| 1611 | + "href": "https://test.invalid/", | ||
| 1612 | + "new_value": "foo\t\r\nbar", | ||
| 1613 | + "expected": { | ||
| 1614 | + "href": "https://foobar/", | ||
| 1615 | + "host": "foobar", | ||
| 1616 | + "hostname": "foobar" | ||
| 1617 | + } | ||
| 1618 | + }, | ||
| 1619 | + { | ||
| 1620 | + "href": "https://test.invalid/", | ||
| 1621 | + "new_value": "><", | ||
| 1622 | + "expected": { | ||
| 1623 | + "href": "https://test.invalid/", | ||
| 1624 | + "host": "test.invalid", | ||
| 1625 | + "hostname": "test.invalid" | ||
| 1626 | + } | ||
| 1555 | 1627 | } | |
| 1556 | 1628 | ], | |
| 1557 | 1629 | "port": [ | |
@@ -1921,8 +1993,8 @@ | |||
| 1921 | 1993 | "href": "a:/", | |
| 1922 | 1994 | "new_value": "\u0000\u0001\t\n\r\u001f !\"#$%&'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~\u007f\u0080\u0081Éé", | |
| 1923 | 1995 | "expected": { | |
| 1924 | - "href": "a:/%00%01%1F%20!%22%23$%&'()*+,-./09:;%3C=%3E%3F@AZ[\\]^_%60az%7B|%7D~%7F%C2%80%C2%81%C3%89%C3%A9", | ||
| 1925 | - "pathname": "/%00%01%1F%20!%22%23$%&'()*+,-./09:;%3C=%3E%3F@AZ[\\]^_%60az%7B|%7D~%7F%C2%80%C2%81%C3%89%C3%A9" | ||
| 1996 | + "href": "a:/%00%01%1F%20!%22%23$%&'()*+,-./09:;%3C=%3E%3F@AZ[\\]%5E_%60az%7B|%7D~%7F%C2%80%C2%81%C3%89%C3%A9", | ||
| 1997 | + "pathname": "/%00%01%1F%20!%22%23$%&'()*+,-./09:;%3C=%3E%3F@AZ[\\]%5E_%60az%7B|%7D~%7F%C2%80%C2%81%C3%89%C3%A9" | ||
| 1926 | 1998 | } | |
| 1927 | 1999 | }, | |
| 1928 | 2000 | { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -259,7 +259,7 @@ | |||
| 259 | 259 | }, | |
| 260 | 260 | { | |
| 261 | 261 | "input": "look\u180Eout.net", | |
| 262 | - "output": null | ||
| 262 | + "output": "lookout.net" | ||
| 263 | 263 | }, | |
| 264 | 264 | { | |
| 265 | 265 | "input": "look\u2060out.net", | |
@@ -291,7 +291,7 @@ | |||
| 291 | 291 | }, | |
| 292 | 292 | { | |
| 293 | 293 | "input": "look\u206Bout.net", | |
| 294 | - "output": null | ||
| 294 | + "output": "lookout.net" | ||
| 295 | 295 | }, | |
| 296 | 296 | { | |
| 297 | 297 | "input": "look\uDB40\uDC01out.net", | |
@@ -319,16 +319,15 @@ | |||
| 319 | 319 | }, | |
| 320 | 320 | { | |
| 321 | 321 | "input": "\u04C0.com", | |
| 322 | - "output": null | ||
| 322 | + "output": "xn--s5a.com" | ||
| 323 | 323 | }, | |
| 324 | 324 | { | |
| 325 | - "comment": "This is U+2F868 (which is mapped to U+36FC starting with Unicode 16.0)", | ||
| 326 | 325 | "input": "\uD87E\uDC68.com", | |
| 327 | 326 | "output": "xn--snl.com" | |
| 328 | 327 | }, | |
| 329 | 328 | { | |
| 330 | 329 | "input": "\u2183.com", | |
| 331 | - "output": null | ||
| 330 | + "output": "xn--r5g.com" | ||
| 332 | 331 | }, | |
| 333 | 332 | { | |
| 334 | 333 | "input": "look\u034Fout.net", | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8507,6 +8507,21 @@ | |||
| 8507 | 8507 | "search": "", | |
| 8508 | 8508 | "username": "" | |
| 8509 | 8509 | }, | |
| 8510 | + { | ||
| 8511 | + "input": "non-special:cannot-be-a-base-url-!\"$%&'()*+,-.;<=>@[\\]^_`{|}~@/", | ||
| 8512 | + "base": null, | ||
| 8513 | + "hash": "", | ||
| 8514 | + "host": "", | ||
| 8515 | + "hostname": "", | ||
| 8516 | + "href": "non-special:cannot-be-a-base-url-!\"$%&'()*+,-.;<=>@[\\]^_`{|}~@/", | ||
| 8517 | + "origin": "null", | ||
| 8518 | + "password": "", | ||
| 8519 | + "pathname": "cannot-be-a-base-url-!\"$%&'()*+,-.;<=>@[\\]^_`{|}~@/", | ||
| 8520 | + "port": "", | ||
| 8521 | + "protocol": "non-special:", | ||
| 8522 | + "search": "", | ||
| 8523 | + "username": "" | ||
| 8524 | + }, | ||
| 8510 | 8525 | { | |
| 8511 | 8526 | "input": "https://www.example.com/path{\u007Fpath.html?query'\u007F=query#fragment<\u007Ffragment", | |
| 8512 | 8527 | "base": null, | |
@@ -8634,10 +8649,10 @@ | |||
| 8634 | 8649 | "hash": "", | |
| 8635 | 8650 | "host": "host", | |
| 8636 | 8651 | "hostname": "host", | |
| 8637 | - "href": "foo://host/%20!%22$%&'()*+,-./:;%3C=%3E@[\\]^_%60%7B|%7D~", | ||
| 8652 | + "href": "foo://host/%20!%22$%&'()*+,-./:;%3C=%3E@[\\]%5E_%60%7B|%7D~", | ||
| 8638 | 8653 | "origin": "null", | |
| 8639 | 8654 | "password": "", | |
| 8640 | - "pathname": "/%20!%22$%&'()*+,-./:;%3C=%3E@[\\]^_%60%7B|%7D~", | ||
| 8655 | + "pathname": "/%20!%22$%&'()*+,-./:;%3C=%3E@[\\]%5E_%60%7B|%7D~", | ||
| 8641 | 8656 | "port":"", | |
| 8642 | 8657 | "protocol": "foo:", | |
| 8643 | 8658 | "search": "", | |
@@ -8649,10 +8664,10 @@ | |||
| 8649 | 8664 | "hash": "", | |
| 8650 | 8665 | "host": "host", | |
| 8651 | 8666 | "hostname": "host", | |
| 8652 | - "href": "wss://host/%20!%22$%&'()*+,-./:;%3C=%3E@[/]^_%60%7B|%7D~", | ||
| 8667 | + "href": "wss://host/%20!%22$%&'()*+,-./:;%3C=%3E@[/]%5E_%60%7B|%7D~", | ||
| 8653 | 8668 | "origin": "wss://host", | |
| 8654 | 8669 | "password": "", | |
| 8655 | - "pathname": "/%20!%22$%&'()*+,-./:;%3C=%3E@[/]^_%60%7B|%7D~", | ||
| 8670 | + "pathname": "/%20!%22$%&'()*+,-./:;%3C=%3E@[/]%5E_%60%7B|%7D~", | ||
| 8656 | 8671 | "port":"", | |
| 8657 | 8672 | "protocol": "wss:", | |
| 8658 | 8673 | "search": "", | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2432,8 +2432,10 @@ | |||
| 2432 | 2432 | }, | |
| 2433 | 2433 | { | |
| 2434 | 2434 | "pattern": [{ "hostname": "bad#hostname" }], | |
| 2435 | - "inputs": [{ "hostname": "bad" }], | ||
| 2436 | - "exactly_empty_components": ["port"], | ||
| 2435 | + "inputs": [{ "hostname": "bad" }], | ||
| 2436 | + "expected_obj": { | ||
| 2437 | + "hostname": "bad" | ||
| 2438 | + }, | ||
| 2437 | 2439 | "expected_match": { | |
| 2438 | 2440 | "hostname": { "input": "bad", "groups": {} } | |
| 2439 | 2441 | } | |
@@ -2445,6 +2447,9 @@ | |||
| 2445 | 2447 | { | |
| 2446 | 2448 | "pattern": [{ "hostname": "bad/hostname" }], | |
| 2447 | 2449 | "inputs": [{ "hostname": "bad" }], | |
| 2450 | + "expected_obj": { | ||
| 2451 | + "hostname": "bad" | ||
| 2452 | + }, | ||
| 2448 | 2453 | "expected_match": { | |
| 2449 | 2454 | "hostname": { "input": "bad", "groups": {} } | |
| 2450 | 2455 | } | |
@@ -2480,6 +2485,9 @@ | |||
| 2480 | 2485 | { | |
| 2481 | 2486 | "pattern": [{ "hostname": "bad\\\\hostname" }], | |
| 2482 | 2487 | "inputs": [{ "hostname": "badhostname" }], | |
| 2488 | + "expected_obj": { | ||
| 2489 | + "hostname": "bad" | ||
| 2490 | + }, | ||
| 2483 | 2491 | "expected_match": null | |
| 2484 | 2492 | }, | |
| 2485 | 2493 | { | |
@@ -2493,20 +2501,29 @@ | |||
| 2493 | 2501 | { | |
| 2494 | 2502 | "pattern": [{ "hostname": "bad\nhostname" }], | |
| 2495 | 2503 | "inputs": [{ "hostname": "badhostname" }], | |
| 2504 | + "expected_obj": { | ||
| 2505 | + "hostname": "badhostname" | ||
| 2506 | + }, | ||
| 2496 | 2507 | "expected_match": { | |
| 2497 | 2508 | "hostname": { "input": "badhostname", "groups": {} } | |
| 2498 | 2509 | } | |
| 2499 | 2510 | }, | |
| 2500 | 2511 | { | |
| 2501 | 2512 | "pattern": [{ "hostname": "bad\rhostname" }], | |
| 2502 | 2513 | "inputs": [{ "hostname": "badhostname" }], | |
| 2514 | + "expected_obj": { | ||
| 2515 | + "hostname": "badhostname" | ||
| 2516 | + }, | ||
| 2503 | 2517 | "expected_match": { | |
| 2504 | 2518 | "hostname": { "input": "badhostname", "groups": {} } | |
| 2505 | 2519 | } | |
| 2506 | 2520 | }, | |
| 2507 | 2521 | { | |
| 2508 | 2522 | "pattern": [{ "hostname": "bad\thostname" }], | |
| 2509 | 2523 | "inputs": [{ "hostname": "badhostname" }], | |
| 2524 | + "expected_obj": { | ||
| 2525 | + "hostname": "badhostname" | ||
| 2526 | + }, | ||
| 2510 | 2527 | "expected_match": { | |
| 2511 | 2528 | "hostname": { "input": "badhostname", "groups": {} } | |
| 2512 | 2529 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments