diff --git a/testing/web-platform/tests/url/resources/setters_tests.json b/testing/web-platform/tests/url/resources/setters_tests.json index d54335f1badec..6c011e2f9acae 100644 --- a/testing/web-platform/tests/url/resources/setters_tests.json +++ b/testing/web-platform/tests/url/resources/setters_tests.json @@ -1848,12 +1848,30 @@ } }, { - "comment": "Simple percent-encoding; nuls, tabs, and newlines are removed", + "comment": "Simple percent-encoding; tabs and newlines are removed", "href": "a:/", "new_value": "\u0000\u0001\t\n\r\u001f !\"#$%&'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~\u007f\u0080\u0081Éé", "expected": { - "href": "a:/#%01%1F%20!%22#$%&'()*+,-./09:;%3C=%3E?@AZ[\\]^_%60az{|}~%7F%C2%80%C2%81%C3%89%C3%A9", - "hash": "#%01%1F%20!%22#$%&'()*+,-./09:;%3C=%3E?@AZ[\\]^_%60az{|}~%7F%C2%80%C2%81%C3%89%C3%A9" + "href": "a:/#%00%01%1F%20!%22#$%&'()*+,-./09:;%3C=%3E?@AZ[\\]^_%60az{|}~%7F%C2%80%C2%81%C3%89%C3%A9", + "hash": "#%00%01%1F%20!%22#$%&'()*+,-./09:;%3C=%3E?@AZ[\\]^_%60az{|}~%7F%C2%80%C2%81%C3%89%C3%A9" + } + }, + { + "comment": "Percent-encode NULLs in fragment", + "href": "http://example.net", + "new_value": "a\u0000b", + "expected": { + "href": "http://example.net/#a%00b", + "hash": "#a%00b" + } + }, + { + "comment": "Percent-encode NULLs in fragment", + "href": "non-spec:/", + "new_value": "a\u0000b", + "expected": { + "href": "non-spec:/#a%00b", + "hash": "#a%00b" } }, { diff --git a/testing/web-platform/tests/url/resources/urltestdata.json b/testing/web-platform/tests/url/resources/urltestdata.json index b2f8964c440da..4ffbd3cde754f 100644 --- a/testing/web-platform/tests/url/resources/urltestdata.json +++ b/testing/web-platform/tests/url/resources/urltestdata.json @@ -6672,7 +6672,7 @@ { "input": "http://example.org/test?a#b\u0000c", "base": "about:blank", - "href": "http://example.org/test?a#bc", + "href": "http://example.org/test?a#b%00c", "protocol": "http:", "username": "", "password": "", @@ -6681,7 +6681,35 @@ "port": "", "pathname": "/test", "search": "?a", - "hash": "#bc" + "hash": "#b%00c" + }, + { + "input": "non-spec://example.org/test?a#b\u0000c", + "base": "about:blank", + "href": "non-spec://example.org/test?a#b%00c", + "protocol": "non-spec:", + "username": "", + "password": "", + "host": "example.org", + "hostname": "example.org", + "port": "", + "pathname": "/test", + "search": "?a", + "hash": "#b%00c" + }, + { + "input": "non-spec:/test?a#b\u0000c", + "base": "about:blank", + "href": "non-spec:/test?a#b%00c", + "protocol": "non-spec:", + "username": "", + "password": "", + "host": "", + "hostname": "", + "port": "", + "pathname": "/test", + "search": "?a", + "hash": "#b%00c" }, "First scheme char - not allowed: https://github.com/whatwg/url/issues/464", {