From 119a51854ae2c7734bd81e329d0dc4bfcde0cf91 Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Sat, 4 Mar 2023 16:58:53 +0900 Subject: [PATCH 1/3] Move some tests from toascii.json to urltestdata.json These were introduced in e9a106175a02a192a7239f42a94235fbe0f0c7a3. However, these are not tests of the Unicode ToASCII algorithm. They are tests of the extra step introduced in https://github.com/whatwg/url/commit/cceb4356cca233b6dfdaabd888263157b2204e44 to the URL Standard. Keep toascii.json focused on testing the ToASCII algorithm, so that software which implements it can use that file. --- url/resources/toascii.json | 17 ----------------- url/resources/urltestdata.json | 28 ++++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 17 deletions(-) diff --git a/url/resources/toascii.json b/url/resources/toascii.json index 4cb41e94cd4a0f..bca28b4a1e454a 100644 --- a/url/resources/toascii.json +++ b/url/resources/toascii.json @@ -160,23 +160,6 @@ "input": "a\u00ADb", "output": "ab" }, - { - "input": "a%C2%ADb", - "output": "ab" - }, - { - "comment": "Empty host after domain to ASCII", - "input": "\u00AD", - "output": null - }, - { - "input": "%C2%AD", - "output": null - }, - { - "input": "xn--", - "output": null - }, { "comment": "Interesting UseSTD3ASCIIRules=false cases", "input": "≠", diff --git a/url/resources/urltestdata.json b/url/resources/urltestdata.json index 19f9ecddbee187..29922e3babec63 100644 --- a/url/resources/urltestdata.json +++ b/url/resources/urltestdata.json @@ -8892,5 +8892,33 @@ "protocol": "https:", "search": "", "username": "" + }, + { + "input": "https://a%C2%ADb/", + "base": "about:blank", + "hash": "", + "host": "ab", + "hostname": "ab", + "href": "https://ab/", + "origin": "https://ab", + "password": "", + "pathname": "/", + "port": "", + "protocol": "https:", + "search": "", + "username": "" + }, + { + "comment": "Empty host after domain to ASCII", + "input": "https://\u00AD/", + "failure": true + }, + { + "input": "https://%C2%AD/", + "failure": true + }, + { + "input": "https://xn--/", + "failure": true } ] From 7981322a58977fcf306bdb734addb53f16104b2b Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Sun, 5 Mar 2023 14:16:54 +0900 Subject: [PATCH 2/3] Also add setter tests --- url/resources/setters_tests.json | 72 ++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/url/resources/setters_tests.json b/url/resources/setters_tests.json index d040d081c6d467..347caf49ab0520 100644 --- a/url/resources/setters_tests.json +++ b/url/resources/setters_tests.json @@ -1061,6 +1061,42 @@ "host": "", "hostname": "" } + }, + { + "href": "https://example.com/", + "new_value": "a%C2%ADb", + "expected": { + "href": "https://ab/", + "host": "ab", + "hostname": "ab" + } + }, + { + "href": "https://example.com/", + "new_value": "\u00AD", + "expected": { + "href": "https://example.com/", + "host": "example.com", + "hostname": "example.com" + } + }, + { + "href": "https://example.com/", + "new_value": "%C2%AD", + "expected": { + "href": "https://example.com/", + "host": "example.com", + "hostname": "example.com" + } + }, + { + "href": "https://example.com/", + "new_value": "xn--", + "expected": { + "href": "https://example.com/", + "host": "example.com", + "hostname": "example.com" + } } ], "hostname": [ @@ -1436,6 +1472,42 @@ "host": "", "hostname": "" } + }, + { + "href": "https://example.com/", + "new_value": "a%C2%ADb", + "expected": { + "href": "https://ab/", + "host": "ab", + "hostname": "ab" + } + }, + { + "href": "https://example.com/", + "new_value": "\u00AD", + "expected": { + "href": "https://example.com/", + "host": "example.com", + "hostname": "example.com" + } + }, + { + "href": "https://example.com/", + "new_value": "%C2%AD", + "expected": { + "href": "https://example.com/", + "host": "example.com", + "hostname": "example.com" + } + }, + { + "href": "https://example.com/", + "new_value": "xn--", + "expected": { + "href": "https://example.com/", + "host": "example.com", + "hostname": "example.com" + } } ], "port": [ From 4fd2345ef4656403e281a8c5e6189e17621b88d4 Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Tue, 7 Mar 2023 20:44:36 +0900 Subject: [PATCH 3/3] Add missing base keys --- url/resources/urltestdata.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/url/resources/urltestdata.json b/url/resources/urltestdata.json index 29922e3babec63..eb414860f27c75 100644 --- a/url/resources/urltestdata.json +++ b/url/resources/urltestdata.json @@ -8911,14 +8911,17 @@ { "comment": "Empty host after domain to ASCII", "input": "https://\u00AD/", + "base": "about:blank", "failure": true }, { "input": "https://%C2%AD/", + "base": "about:blank", "failure": true }, { "input": "https://xn--/", + "base": "about:blank", "failure": true } ]