| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 66016e2 commit 95bbd0f
17 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -28,7 +28,7 @@ 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/fbf1e7d247/resources | |
| 30 | 30 | - streams: https://github.com/web-platform-tests/wpt/tree/9e5ef42bd3/streams | |
| 31 | - - url: https://github.com/web-platform-tests/wpt/tree/0a187bc169/url | ||
| 31 | + - url: https://github.com/web-platform-tests/wpt/tree/f1ade799d0/url | ||
| 32 | 32 | - user-timing: https://github.com/web-platform-tests/wpt/tree/df24fb604e/user-timing | |
| 33 | 33 | - wasm/jsapi: https://github.com/web-platform-tests/wpt/tree/d8dbe6990b/wasm/jsapi | |
| 34 | 34 | - 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,41 @@ | |||
| 1 | + promise_test(() => fetch("resources/IdnaTestV2.json").then(res => res.json()).then(runTests), "Loading data…"); | ||
| 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 | + function runTests(idnaTests) { | ||
| 18 | + for (const idnaTest of idnaTests) { | ||
| 19 | + if (typeof idnaTest === "string") { | ||
| 20 | + continue // skip comments | ||
| 21 | + } | ||
| 22 | + if (idnaTest.input === "") { | ||
| 23 | + continue // cannot test empty string input through new URL() | ||
| 24 | + } | ||
| 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 | + | ||
| 29 | + test(() => { | ||
| 30 | + if (idnaTest.output === null) { | ||
| 31 | + assert_throws_js(TypeError, () => new URL(`https://${encodedInput}/x`)); | ||
| 32 | + } else { | ||
| 33 | + const url = new URL(`https://${encodedInput}/x`); | ||
| 34 | + assert_equals(url.host, idnaTest.output); | ||
| 35 | + assert_equals(url.hostname, idnaTest.output); | ||
| 36 | + assert_equals(url.pathname, "/x"); | ||
| 37 | + assert_equals(url.href, `https://${idnaTest.output}/x`); | ||
| 38 | + } | ||
| 39 | + }, `ToASCII("${idnaTest.input}")${idnaTest.comment ? " " + idnaTest.comment : ""}`); | ||
| 40 | + } | ||
| 41 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,8 +3,13 @@ | |||
| 3 | 3 | <html xmlns="http://www.w3.org/1999/xhtml"> | |
| 4 | 4 | <head> | |
| 5 | 5 | <title>URL Test</title> | |
| 6 | + <meta name="variant" content="?include=file"/> | ||
| 7 | + <meta name="variant" content="?include=javascript"/> | ||
| 8 | + <meta name="variant" content="?include=mailto"/> | ||
| 9 | + <meta name="variant" content="?exclude=(file|javascript|mailto)"/> | ||
| 6 | 10 | <script src="/resources/testharness.js"></script> | |
| 7 | 11 | <script src="/resources/testharnessreport.js"></script> | |
| 12 | + <script src="/common/subset-tests-by-key.js"></script> | ||
| 8 | 13 | <base id="base"/> | |
| 9 | 14 | </head> | |
| 10 | 15 | <body> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,7 +1,12 @@ | |||
| 1 | 1 | <!doctype html> | |
| 2 | 2 | <meta charset=utf-8> | |
| 3 | + <meta name="variant" content="?include=file"> | ||
| 4 | + <meta name="variant" content="?include=javascript"> | ||
| 5 | + <meta name="variant" content="?include=mailto"> | ||
| 6 | + <meta name="variant" content="?exclude=(file|javascript|mailto)"> | ||
| 3 | 7 | <script src=/resources/testharness.js></script> | |
| 4 | 8 | <script src=/resources/testharnessreport.js></script> | |
| 9 | + <script src="/common/subset-tests-by-key.js"></script> | ||
| 5 | 10 | <base id=base> | |
| 6 | 11 | <div id=log></div> | |
| 7 | 12 | <script src=resources/a-element.js></script> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -28,4 +28,12 @@ test(function() { | |||
| 28 | 28 | assert_equals(URL.domainToUnicode, undefined); | |
| 29 | 29 | }, "URL.domainToUnicode should be undefined"); | |
| 30 | 30 | ||
| 31 | + test(() => { | ||
| 32 | + assert_throws_dom("DataCloneError", () => self.structuredClone(new URL("about:blank"))); | ||
| 33 | + }, "URL: no structured serialize/deserialize support"); | ||
| 34 | + | ||
| 35 | + test(() => { | ||
| 36 | + assert_throws_dom("DataCloneError", () => self.structuredClone(new URLSearchParams())); | ||
| 37 | + }, "URLSearchParams: no structured serialize/deserialize support"); | ||
| 38 | + | ||
| 31 | 39 | done(); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments