| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent e9be209 commit 7773d58
10 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1766,16 +1766,16 @@ void URL::Parse(const char* input, | |||
| 1766 | 1766 | url->flags |= URL_FLAGS_FAILED; | |
| 1767 | 1767 | return; | |
| 1768 | 1768 | } | |
| 1769 | + if (state_override == kHostname) { | ||
| 1770 | + return; | ||
| 1771 | + } | ||
| 1769 | 1772 | url->flags |= URL_FLAGS_HAS_HOST; | |
| 1770 | 1773 | if (!ParseHost(buffer, &url->host, special)) { | |
| 1771 | 1774 | url->flags |= URL_FLAGS_FAILED; | |
| 1772 | 1775 | return; | |
| 1773 | 1776 | } | |
| 1774 | 1777 | buffer.clear(); | |
| 1775 | 1778 | state = kPort; | |
| 1776 | - if (state_override == kHostname) { | ||
| 1777 | - return; | ||
| 1778 | - } | ||
| 1779 | 1779 | } else if (ch == kEOL || | |
| 1780 | 1780 | ch == '/' || | |
| 1781 | 1781 | ch == '?' || | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,6 @@ | |||
| 1 | 1 | # The 3-Clause BSD License | |
| 2 | 2 | ||
| 3 | - Copyright 2019 web-platform-tests contributors | ||
| 3 | + Copyright © web-platform-tests contributors | ||
| 4 | 4 | ||
| 5 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | |
| 6 | 6 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -21,7 +21,7 @@ Last update: | |||
| 21 | 21 | - html/webappapis/timers: https://github.com/web-platform-tests/wpt/tree/5873f2d8f1/html/webappapis/timers | |
| 22 | 22 | - interfaces: https://github.com/web-platform-tests/wpt/tree/79fa4cf76e/interfaces | |
| 23 | 23 | - resources: https://github.com/web-platform-tests/wpt/tree/972ca5b669/resources | |
| 24 | - - url: https://github.com/web-platform-tests/wpt/tree/1439087f27/url | ||
| 24 | + - url: https://github.com/web-platform-tests/wpt/tree/1fcb39223d/url | ||
| 25 | 25 | ||
| 26 | 26 | [Web Platform Tests]: https://github.com/web-platform-tests/wpt | |
| 27 | 27 | [`git node wpt`]: https://github.com/nodejs/node-core-utils/blob/master/docs/git-node.md#git-node-wpt | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -28,22 +28,27 @@ | |||
| 28 | 28 | assert_throws_js(TypeError, () => url.href = test.input) | |
| 29 | 29 | }, "URL's href: " + name) | |
| 30 | 30 | ||
| 31 | - self.test(() => { | ||
| 32 | - const client = new XMLHttpRequest() | ||
| 33 | - assert_throws_dom("SyntaxError", () => client.open("GET", test.input)) | ||
| 34 | - }, "XHR: " + name) | ||
| 35 | - | ||
| 36 | - self.test(() => { | ||
| 37 | - assert_throws_js(TypeError, () => self.navigator.sendBeacon(test.input)) | ||
| 38 | - }, "sendBeacon(): " + name) | ||
| 39 | - | ||
| 40 | - self.test(() => { | ||
| 41 | - assert_throws_js(self[0].TypeError, () => self[0].location = test.input) | ||
| 42 | - }, "Location's href: " + name) | ||
| 43 | - | ||
| 44 | - self.test(() => { | ||
| 45 | - assert_throws_dom("SyntaxError", () => self.open(test.input).close()) | ||
| 46 | - }, "window.open(): " + name) | ||
| 31 | + // The following use cases resolve the URL input relative to the current | ||
| 32 | + // document's URL. If this test input could be construed as a valid URL | ||
| 33 | + // when resolved against a base URL, skip these cases. | ||
| 34 | + if (!test.inputCanBeRelative) { | ||
| 35 | + self.test(() => { | ||
| 36 | + const client = new XMLHttpRequest() | ||
| 37 | + assert_throws_dom("SyntaxError", () => client.open("GET", test.input)) | ||
| 38 | + }, "XHR: " + name) | ||
| 39 | + | ||
| 40 | + self.test(() => { | ||
| 41 | + assert_throws_js(TypeError, () => self.navigator.sendBeacon(test.input)) | ||
| 42 | + }, "sendBeacon(): " + name) | ||
| 43 | + | ||
| 44 | + self.test(() => { | ||
| 45 | + assert_throws_js(self[0].TypeError, () => self[0].location = test.input) | ||
| 46 | + }, "Location's href: " + name) | ||
| 47 | + | ||
| 48 | + self.test(() => { | ||
| 49 | + assert_throws_dom("SyntaxError", () => self.open(test.input).close()) | ||
| 50 | + }, "window.open(): " + name) | ||
| 51 | + } | ||
| 47 | 52 | } | |
| 48 | 53 | } | |
| 49 | 54 | </script> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1153,24 +1153,24 @@ | |||
| 1153 | 1153 | } | |
| 1154 | 1154 | }, | |
| 1155 | 1155 | { | |
| 1156 | - "comment": "Stuff after a : delimiter is ignored", | ||
| 1156 | + "comment": ": delimiter invalidates entire value", | ||
| 1157 | 1157 | "href": "http://example.net/path", | |
| 1158 | 1158 | "new_value": "example.com:8080", | |
| 1159 | 1159 | "expected": { | |
| 1160 | - "href": "http://example.com/path", | ||
| 1161 | - "host": "example.com", | ||
| 1162 | - "hostname": "example.com", | ||
| 1160 | + "href": "http://example.net/path", | ||
| 1161 | + "host": "example.net", | ||
| 1162 | + "hostname": "example.net", | ||
| 1163 | 1163 | "port": "" | |
| 1164 | 1164 | } | |
| 1165 | 1165 | }, | |
| 1166 | 1166 | { | |
| 1167 | - "comment": "Stuff after a : delimiter is ignored", | ||
| 1167 | + "comment": ": delimiter invalidates entire value", | ||
| 1168 | 1168 | "href": "http://example.net:8080/path", | |
| 1169 | 1169 | "new_value": "example.com:", | |
| 1170 | 1170 | "expected": { | |
| 1171 | - "href": "http://example.com:8080/path", | ||
| 1172 | - "host": "example.com:8080", | ||
| 1173 | - "hostname": "example.com", | ||
| 1171 | + "href": "http://example.net:8080/path", | ||
| 1172 | + "host": "example.net:8080", | ||
| 1173 | + "hostname": "example.net", | ||
| 1174 | 1174 | "port": "8080" | |
| 1175 | 1175 | } | |
| 1176 | 1176 | }, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3156,7 +3156,8 @@ | |||
| 3156 | 3156 | { | |
| 3157 | 3157 | "input": "http:/:@/www.example.com", | |
| 3158 | 3158 | "base": "about:blank", | |
| 3159 | - "failure": true | ||
| 3159 | + "failure": true, | ||
| 3160 | + "inputCanBeRelative": true | ||
| 3160 | 3161 | }, | |
| 3161 | 3162 | { | |
| 3162 | 3163 | "input": "http://user@/www.example.com", | |
@@ -3166,12 +3167,14 @@ | |||
| 3166 | 3167 | { | |
| 3167 | 3168 | "input": "http:@/www.example.com", | |
| 3168 | 3169 | "base": "about:blank", | |
| 3169 | - "failure": true | ||
| 3170 | + "failure": true, | ||
| 3171 | + "inputCanBeRelative": true | ||
| 3170 | 3172 | }, | |
| 3171 | 3173 | { | |
| 3172 | 3174 | "input": "http:/@/www.example.com", | |
| 3173 | 3175 | "base": "about:blank", | |
| 3174 | - "failure": true | ||
| 3176 | + "failure": true, | ||
| 3177 | + "inputCanBeRelative": true | ||
| 3175 | 3178 | }, | |
| 3176 | 3179 | { | |
| 3177 | 3180 | "input": "http://@/www.example.com", | |
@@ -3181,17 +3184,20 @@ | |||
| 3181 | 3184 | { | |
| 3182 | 3185 | "input": "https:@/www.example.com", | |
| 3183 | 3186 | "base": "about:blank", | |
| 3184 | - "failure": true | ||
| 3187 | + "failure": true, | ||
| 3188 | + "inputCanBeRelative": true | ||
| 3185 | 3189 | }, | |
| 3186 | 3190 | { | |
| 3187 | 3191 | "input": "http:a:b@/www.example.com", | |
| 3188 | 3192 | "base": "about:blank", | |
| 3189 | - "failure": true | ||
| 3193 | + "failure": true, | ||
| 3194 | + "inputCanBeRelative": true | ||
| 3190 | 3195 | }, | |
| 3191 | 3196 | { | |
| 3192 | 3197 | "input": "http:/a:b@/www.example.com", | |
| 3193 | 3198 | "base": "about:blank", | |
| 3194 | - "failure": true | ||
| 3199 | + "failure": true, | ||
| 3200 | + "inputCanBeRelative": true | ||
| 3195 | 3201 | }, | |
| 3196 | 3202 | { | |
| 3197 | 3203 | "input": "http://a:b@/www.example.com", | |
@@ -3201,7 +3207,8 @@ | |||
| 3201 | 3207 | { | |
| 3202 | 3208 | "input": "http::@/www.example.com", | |
| 3203 | 3209 | "base": "about:blank", | |
| 3204 | - "failure": true | ||
| 3210 | + "failure": true, | ||
| 3211 | + "inputCanBeRelative": true | ||
| 3205 | 3212 | }, | |
| 3206 | 3213 | { | |
| 3207 | 3214 | "input": "http:a:@www.example.com", | |
@@ -3645,6 +3652,17 @@ | |||
| 3645 | 3652 | "search": "?%EF%BF%BD", | |
| 3646 | 3653 | "hash": "#%EF%BF%BD" | |
| 3647 | 3654 | }, | |
| 3655 | + "Domain is ASCII, but a label is invalid IDNA", | ||
| 3656 | + { | ||
| 3657 | + "input": "http://a.b.c.xn--pokxncvks", | ||
| 3658 | + "base": "about:blank", | ||
| 3659 | + "failure": true | ||
| 3660 | + }, | ||
| 3661 | + { | ||
| 3662 | + "input": "http://10.0.0.xn--pokxncvks", | ||
| 3663 | + "base": "about:blank", | ||
| 3664 | + "failure": true | ||
| 3665 | + }, | ||
| 3648 | 3666 | "Test name prepping, fullwidth input should be converted to ASCII and NOT IDN-ized. This is 'Go' in fullwidth UTF-8/UTF-16.", | |
| 3649 | 3667 | { | |
| 3650 | 3668 | "input": "http://Go.com", | |
@@ -7320,17 +7338,20 @@ | |||
| 7320 | 7338 | { | |
| 7321 | 7339 | "input": "a", | |
| 7322 | 7340 | "base": "about:blank", | |
| 7323 | - "failure": true | ||
| 7341 | + "failure": true, | ||
| 7342 | + "inputCanBeRelative": true | ||
| 7324 | 7343 | }, | |
| 7325 | 7344 | { | |
| 7326 | 7345 | "input": "a/", | |
| 7327 | 7346 | "base": "about:blank", | |
| 7328 | - "failure": true | ||
| 7347 | + "failure": true, | ||
| 7348 | + "inputCanBeRelative": true | ||
| 7329 | 7349 | }, | |
| 7330 | 7350 | { | |
| 7331 | 7351 | "input": "a//", | |
| 7332 | 7352 | "base": "about:blank", | |
| 7333 | - "failure": true | ||
| 7353 | + "failure": true, | ||
| 7354 | + "inputCanBeRelative": true | ||
| 7334 | 7355 | }, | |
| 7335 | 7356 | "Bases that don't fail to parse but fail to be bases", | |
| 7336 | 7357 | { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,9 +1,5 @@ | |||
| 1 | - <!doctype html> | ||
| 2 | - <meta charset=utf-8> | ||
| 3 | - <script src=/resources/testharness.js></script> | ||
| 4 | - <script src=/resources/testharnessreport.js></script> | ||
| 5 | - <div id=log></div> | ||
| 6 | - <script> | ||
| 1 | + // Keep this file in sync with url-setters.any.js. | ||
| 2 | + | ||
| 7 | 3 | promise_test(() => fetch("resources/setters_tests.json").then(res => res.json()).then(runURLSettersTests), "Loading data…"); | |
| 8 | 4 | ||
| 9 | 5 | function runURLSettersTests(all_test_cases) { | |
@@ -19,13 +15,6 @@ | |||
| 19 | 15 | if ("comment" in test_case) { | |
| 20 | 16 | name += " " + test_case.comment; | |
| 21 | 17 | } | |
| 22 | - test(function() { | ||
| 23 | - var url = new URL(test_case.href); | ||
| 24 | - url[attribute_to_be_set] = test_case.new_value; | ||
| 25 | - for (var attribute in test_case.expected) { | ||
| 26 | - assert_equals(url[attribute], test_case.expected[attribute]) | ||
| 27 | - } | ||
| 28 | - }, "URL: " + name) | ||
| 29 | 18 | test(function() { | |
| 30 | 19 | var url = document.createElement("a"); | |
| 31 | 20 | url.href = test_case.href; | |
@@ -45,4 +34,3 @@ | |||
| 45 | 34 | } | |
| 46 | 35 | } | |
| 47 | 36 | } | |
| 48 | - </script> | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,27 @@ | |||
| 1 | + // Keep this file in sync with url-setters-a-area.window.js. | ||
| 2 | + | ||
| 3 | + promise_test(() => fetch("resources/setters_tests.json").then(res => res.json()).then(runURLSettersTests), "Loading data…"); | ||
| 4 | + | ||
| 5 | + function runURLSettersTests(all_test_cases) { | ||
| 6 | + for (var attribute_to_be_set in all_test_cases) { | ||
| 7 | + if (attribute_to_be_set == "comment") { | ||
| 8 | + continue; | ||
| 9 | + } | ||
| 10 | + var test_cases = all_test_cases[attribute_to_be_set]; | ||
| 11 | + for(var i = 0, l = test_cases.length; i < l; i++) { | ||
| 12 | + var test_case = test_cases[i]; | ||
| 13 | + var name = "Setting <" + test_case.href + ">." + attribute_to_be_set + | ||
| 14 | + " = '" + test_case.new_value + "'"; | ||
| 15 | + if ("comment" in test_case) { | ||
| 16 | + name += " " + test_case.comment; | ||
| 17 | + } | ||
| 18 | + test(function() { | ||
| 19 | + var url = new URL(test_case.href); | ||
| 20 | + url[attribute_to_be_set] = test_case.new_value; | ||
| 21 | + for (var attribute in test_case.expected) { | ||
| 22 | + assert_equals(url[attribute], test_case.expected[attribute]) | ||
| 23 | + } | ||
| 24 | + }, "URL: " + name) | ||
| 25 | + } | ||
| 26 | + } | ||
| 27 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -44,7 +44,7 @@ | |||
| 44 | 44 | "path": "resources" | |
| 45 | 45 | }, | |
| 46 | 46 | "url": { | |
| 47 | - "commit": "1439087f27135b06deb70ffbf43e65ff64ff1ee6", | ||
| 47 | + "commit": "1fcb39223d3009fbb46c1b254755d6cc75e290f1", | ||
| 48 | 48 | "path": "url" | |
| 49 | 49 | } | |
| 50 | 50 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -24,5 +24,11 @@ | |||
| 24 | 24 | }, | |
| 25 | 25 | "url-origin.any.js": { | |
| 26 | 26 | "requires": ["small-icu"] | |
| 27 | + }, | ||
| 28 | + "url-setters.any.js": { | ||
| 29 | + "requires": ["small-icu"] | ||
| 30 | + }, | ||
| 31 | + "url-setters-a-area.window.js": { | ||
| 32 | + "skip": "already tested in url-setters.any.js" | ||
| 27 | 33 | } | |
| 28 | 34 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments