| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -27,7 +27,7 @@ Last update: | |||
| 27 | 27 | - resource-timing: https://github.com/web-platform-tests/wpt/tree/22d38586d0/resource-timing | |
| 28 | 28 | - resources: https://github.com/web-platform-tests/wpt/tree/919874f84f/resources | |
| 29 | 29 | - streams: https://github.com/web-platform-tests/wpt/tree/51750bc8d7/streams | |
| 30 | - - url: https://github.com/web-platform-tests/wpt/tree/1eaeb0e178/url | ||
| 30 | + - url: https://github.com/web-platform-tests/wpt/tree/84caeb6fbd/url | ||
| 31 | 31 | - user-timing: https://github.com/web-platform-tests/wpt/tree/df24fb604e/user-timing | |
| 32 | 32 | - wasm/jsapi: https://github.com/web-platform-tests/wpt/tree/d8dbe6990b/wasm/jsapi | |
| 33 | 33 | - wasm/webapi: https://github.com/web-platform-tests/wpt/tree/fd1b23eeaa/wasm/webapi | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,63 @@ | |||
| 1 | + // The results of this test are all over the map due to browsers behaving very differently for | ||
| 2 | + // javascript: URLs. | ||
| 3 | + // | ||
| 4 | + // Chromium is pretty close execution-wise, but it parses javascript: URLs incorrectly. | ||
| 5 | + // Gecko navigates to non-string return values of the result of executing a javascript: URL. | ||
| 6 | + // WebKit executes javascript: URLs too early and has a harness error due to URL parsing. | ||
| 7 | + // | ||
| 8 | + // The expectations below should match the HTML and URL standards. | ||
| 9 | + [ | ||
| 10 | + { | ||
| 11 | + "description": "javascript: URL that fails to parse due to invalid host", | ||
| 12 | + "input": "javascript://test:test/%0aglobalThis.shouldNotExistA=1", | ||
| 13 | + "property": "shouldNotExistA", | ||
| 14 | + "expected": undefined | ||
| 15 | + }, | ||
| 16 | + { | ||
| 17 | + "description": "javascript: URL that fails to parse due to invalid host and has a U+0009 in scheme", | ||
| 18 | + "input": "java\x09script://test:test/%0aglobalThis.shouldNotExistB=1", | ||
| 19 | + "property": "shouldNotExistB", | ||
| 20 | + "expected": undefined | ||
| 21 | + }, | ||
| 22 | + { | ||
| 23 | + "description": "javascript: URL without an opaque path", | ||
| 24 | + "input": "javascript://host/1%0a//../0/;globalThis.shouldBeOne=1;/%0aglobalThis.shouldBeOne=2;/..///", | ||
| 25 | + "property": "shouldBeOne", | ||
| 26 | + "expected": 1 | ||
| 27 | + }, | ||
| 28 | + { | ||
| 29 | + "description": "javascript: URL containing a JavaScript string split over path and query", | ||
| 30 | + // Use ";undefined" to avoid returning a string. | ||
| 31 | + "input": "javascript:globalThis.shouldBeAStringA = \"https://whatsoever.com/?a=b&c=5&x=y\";undefined", | ||
| 32 | + "property": "shouldBeAStringA", | ||
| 33 | + "expected": "https://whatsoever.com/?a=b&c=5&x=y" | ||
| 34 | + }, | ||
| 35 | + { | ||
| 36 | + "description": "javascript: URL containing a JavaScript string split over path and query and has a U+000A in scheme", | ||
| 37 | + // Use ";undefined" to avoid returning a string. | ||
| 38 | + "input": "java\x0Ascript:globalThis.shouldBeAStringB = \"https://whatsoever.com/?a=b&c=5&x=y\";undefined", | ||
| 39 | + "property": "shouldBeAStringB", | ||
| 40 | + "expected": "https://whatsoever.com/?a=b&c=5&x=y" | ||
| 41 | + } | ||
| 42 | + ].forEach(({ description, input, property, expected }) => { | ||
| 43 | + // Use promise_test so the tests run in sequence. Needed for globalThis.verify below. | ||
| 44 | + promise_test(t => { | ||
| 45 | + const anchor = document.body.appendChild(document.createElement("a")); | ||
| 46 | + t.add_cleanup(() => anchor.remove()); | ||
| 47 | + anchor.href = input; | ||
| 48 | + assert_equals(globalThis[property], undefined, "Property is undefined before the click"); | ||
| 49 | + anchor.click(); | ||
| 50 | + assert_equals(globalThis[property], undefined, "Property is undefined immediately after the click"); | ||
| 51 | + | ||
| 52 | + // Since we cannot reliably queue a task to run after the task queued as a result of the click() | ||
| 53 | + // above, we do another click() with a new URL. | ||
| 54 | + return new Promise(resolve => { | ||
| 55 | + globalThis.verify = t.step_func(() => { | ||
| 56 | + assert_equals(globalThis[property], expected, `Property is ${expected} once the navigation happened`); | ||
| 57 | + resolve(); | ||
| 58 | + }); | ||
| 59 | + anchor.href = "javascript:globalThis.verify()"; | ||
| 60 | + anchor.click(); | ||
| 61 | + }); | ||
| 62 | + }, description); | ||
| 63 | + }); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1061,6 +1061,42 @@ | |||
| 1061 | 1061 | "host": "", | |
| 1062 | 1062 | "hostname": "" | |
| 1063 | 1063 | } | |
| 1064 | + }, | ||
| 1065 | + { | ||
| 1066 | + "href": "https://example.com/", | ||
| 1067 | + "new_value": "a%C2%ADb", | ||
| 1068 | + "expected": { | ||
| 1069 | + "href": "https://ab/", | ||
| 1070 | + "host": "ab", | ||
| 1071 | + "hostname": "ab" | ||
| 1072 | + } | ||
| 1073 | + }, | ||
| 1074 | + { | ||
| 1075 | + "href": "https://example.com/", | ||
| 1076 | + "new_value": "\u00AD", | ||
| 1077 | + "expected": { | ||
| 1078 | + "href": "https://example.com/", | ||
| 1079 | + "host": "example.com", | ||
| 1080 | + "hostname": "example.com" | ||
| 1081 | + } | ||
| 1082 | + }, | ||
| 1083 | + { | ||
| 1084 | + "href": "https://example.com/", | ||
| 1085 | + "new_value": "%C2%AD", | ||
| 1086 | + "expected": { | ||
| 1087 | + "href": "https://example.com/", | ||
| 1088 | + "host": "example.com", | ||
| 1089 | + "hostname": "example.com" | ||
| 1090 | + } | ||
| 1091 | + }, | ||
| 1092 | + { | ||
| 1093 | + "href": "https://example.com/", | ||
| 1094 | + "new_value": "xn--", | ||
| 1095 | + "expected": { | ||
| 1096 | + "href": "https://example.com/", | ||
| 1097 | + "host": "example.com", | ||
| 1098 | + "hostname": "example.com" | ||
| 1099 | + } | ||
| 1064 | 1100 | } | |
| 1065 | 1101 | ], | |
| 1066 | 1102 | "hostname": [ | |
@@ -1436,6 +1472,42 @@ | |||
| 1436 | 1472 | "host": "", | |
| 1437 | 1473 | "hostname": "" | |
| 1438 | 1474 | } | |
| 1475 | + }, | ||
| 1476 | + { | ||
| 1477 | + "href": "https://example.com/", | ||
| 1478 | + "new_value": "a%C2%ADb", | ||
| 1479 | + "expected": { | ||
| 1480 | + "href": "https://ab/", | ||
| 1481 | + "host": "ab", | ||
| 1482 | + "hostname": "ab" | ||
| 1483 | + } | ||
| 1484 | + }, | ||
| 1485 | + { | ||
| 1486 | + "href": "https://example.com/", | ||
| 1487 | + "new_value": "\u00AD", | ||
| 1488 | + "expected": { | ||
| 1489 | + "href": "https://example.com/", | ||
| 1490 | + "host": "example.com", | ||
| 1491 | + "hostname": "example.com" | ||
| 1492 | + } | ||
| 1493 | + }, | ||
| 1494 | + { | ||
| 1495 | + "href": "https://example.com/", | ||
| 1496 | + "new_value": "%C2%AD", | ||
| 1497 | + "expected": { | ||
| 1498 | + "href": "https://example.com/", | ||
| 1499 | + "host": "example.com", | ||
| 1500 | + "hostname": "example.com" | ||
| 1501 | + } | ||
| 1502 | + }, | ||
| 1503 | + { | ||
| 1504 | + "href": "https://example.com/", | ||
| 1505 | + "new_value": "xn--", | ||
| 1506 | + "expected": { | ||
| 1507 | + "href": "https://example.com/", | ||
| 1508 | + "host": "example.com", | ||
| 1509 | + "hostname": "example.com" | ||
| 1510 | + } | ||
| 1439 | 1511 | } | |
| 1440 | 1512 | ], | |
| 1441 | 1513 | "port": [ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -160,23 +160,6 @@ | |||
| 160 | 160 | "input": "a\u00ADb", | |
| 161 | 161 | "output": "ab" | |
| 162 | 162 | }, | |
| 163 | - { | ||
| 164 | - "input": "a%C2%ADb", | ||
| 165 | - "output": "ab" | ||
| 166 | - }, | ||
| 167 | - { | ||
| 168 | - "comment": "Empty host after domain to ASCII", | ||
| 169 | - "input": "\u00AD", | ||
| 170 | - "output": null | ||
| 171 | - }, | ||
| 172 | - { | ||
| 173 | - "input": "%C2%AD", | ||
| 174 | - "output": null | ||
| 175 | - }, | ||
| 176 | - { | ||
| 177 | - "input": "xn--", | ||
| 178 | - "output": null | ||
| 179 | - }, | ||
| 180 | 163 | { | |
| 181 | 164 | "comment": "Interesting UseSTD3ASCIIRules=false cases", | |
| 182 | 165 | "input": "≠", | |
| Back | FazBrowse Home | New Git URL |
0 commit comments