From 242d577ff466d6a54c01949bda0c1ccc48a556c2 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Fri, 20 Jan 2017 16:25:54 +0100 Subject: [PATCH 1/7] Leftover tests These used to be part of https://github.com/w3c/web-platform-tests/pull/4406. --- url/urltestdata.json | 104 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) diff --git a/url/urltestdata.json b/url/urltestdata.json index 9445d2775c10cb..a431f9abd6dc03 100644 --- a/url/urltestdata.json +++ b/url/urltestdata.json @@ -4896,5 +4896,109 @@ "input": "http://#", "base": "about:blank", "failure": "true" + }, + "# Non-special-URL path tests", + { + "input": "sc://ñ", + "base": "about:blank", + "href": "sc://%C3%B1", + "origin": "null", + "protocol": "sc:", + "username": "", + "password": "", + "host": "%C3%B1", + "hostname": "%C3%B1", + "port": "", + "pathname": "", + "search": "", + "hash": "" + }, + { + "input": "sc://ñ?x", + "base": "about:blank", + "href": "sc://%C3%B1?x", + "origin": "null", + "protocol": "sc:", + "username": "", + "password": "", + "host": "%C3%B1", + "hostname": "%C3%B1", + "port": "", + "pathname": "", + "search": "?x", + "hash": "" + }, + { + "input": "sc://ñ#x", + "base": "about:blank", + "href": "sc://%C3%B1#x", + "origin": "null", + "protocol": "sc:", + "username": "", + "password": "", + "host": "%C3%B1", + "hostname": "%C3%B1", + "port": "", + "pathname": "", + "search": "", + "hash": "#x" + }, + { + "input": "#x", + "base": "sc://ñ", + "href": "sc://%C3%B1#x", + "origin": "null", + "protocol": "sc:", + "username": "", + "password": "", + "host": "%C3%B1", + "hostname": "%C3%B1", + "port": "", + "pathname": "", + "search": "", + "hash": "#x" + }, + { + "input": "?x", + "base": "sc://ñ", + "href": "sc://%C3%B1?x", + "origin": "null", + "protocol": "sc:", + "username": "", + "password": "", + "host": "%C3%B1", + "hostname": "%C3%B1", + "port": "", + "pathname": "", + "search": "?x", + "hash": "" + }, + { + "input": "sc://?", + "base": "about:blank", + "href": "sc://?", + "protocol": "sc:", + "username": "", + "password": "", + "host": "", + "hostname": "", + "port": "", + "pathname": "", + "search": "", + "hash": "" + }, + { + "input": "sc://#", + "base": "about:blank", + "href": "sc://#", + "protocol": "sc:", + "username": "", + "password": "", + "host": "", + "hostname": "", + "port": "", + "pathname": "", + "search": "", + "hash": "" } ] From 2fde83056187bc8188d8c062bb3859f0c352c9f0 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Fri, 20 Jan 2017 16:28:25 +0100 Subject: [PATCH 2/7] Non-special URLs shouldn't eat slashes See https://github.com/whatwg/url/issues/212. --- url/urltestdata.json | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/url/urltestdata.json b/url/urltestdata.json index a431f9abd6dc03..ed9486bfdb4794 100644 --- a/url/urltestdata.json +++ b/url/urltestdata.json @@ -5000,5 +5000,47 @@ "pathname": "", "search": "", "hash": "" + }, + { + "input": "///", + "base": "sc://x/", + "href": "sc:///", + "protocol": "sc:", + "username": "", + "password": "", + "host": "", + "hostname": "", + "port": "", + "pathname": "/", + "search": "", + "hash": "" + }, + { + "input": "////", + "base": "sc://x/", + "href": "sc:////", + "protocol": "sc:", + "username": "", + "password": "", + "host": "", + "hostname": "", + "port": "", + "pathname": "/", + "search": "", + "hash": "" + }, + { + "input": "////x/", + "base": "sc://x/", + "href": "sc:////x/", + "protocol": "sc:", + "username": "", + "password": "", + "host": "", + "hostname": "", + "port": "", + "pathname": "//x/", + "search": "", + "hash": "" } ] From cc26eb3f43d2100be083f105d94464d3536af1e0 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Fri, 20 Jan 2017 16:52:42 +0100 Subject: [PATCH 3/7] Fix existing tests --- url/setters_tests.json | 24 ++++++++++++------------ url/urltestdata.json | 4 ++-- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/url/setters_tests.json b/url/setters_tests.json index ab68bcbb27aaae..dcfeb6993fbe65 100644 --- a/url/setters_tests.json +++ b/url/setters_tests.json @@ -27,7 +27,7 @@ "href": "a://example.net", "new_value": "", "expected": { - "href": "a://example.net/", + "href": "a://example.net", "protocol": "a:" } }, @@ -35,7 +35,7 @@ "href": "a://example.net", "new_value": "b", "expected": { - "href": "b://example.net/", + "href": "b://example.net", "protocol": "b:" } }, @@ -44,7 +44,7 @@ "href": "a://example.net", "new_value": "B", "expected": { - "href": "b://example.net/", + "href": "b://example.net", "protocol": "b:" } }, @@ -53,7 +53,7 @@ "href": "a://example.net", "new_value": "é", "expected": { - "href": "a://example.net/", + "href": "a://example.net", "protocol": "a:" } }, @@ -62,7 +62,7 @@ "href": "a://example.net", "new_value": "0b", "expected": { - "href": "a://example.net/", + "href": "a://example.net", "protocol": "a:" } }, @@ -71,7 +71,7 @@ "href": "a://example.net", "new_value": "+b", "expected": { - "href": "a://example.net/", + "href": "a://example.net", "protocol": "a:" } }, @@ -79,7 +79,7 @@ "href": "a://example.net", "new_value": "bC0+-.", "expected": { - "href": "bc0+-.://example.net/", + "href": "bc0+-.://example.net", "protocol": "bc0+-.:" } }, @@ -88,7 +88,7 @@ "href": "a://example.net", "new_value": "b,c", "expected": { - "href": "a://example.net/", + "href": "a://example.net", "protocol": "a:" } }, @@ -97,7 +97,7 @@ "href": "a://example.net", "new_value": "bé", "expected": { - "href": "a://example.net/", + "href": "a://example.net", "protocol": "a:" } }, @@ -140,7 +140,7 @@ "href": "ssh://me@example.net", "new_value": "http", "expected": { - "href": "ssh://me@example.net/", + "href": "ssh://me@example.net", "protocol": "ssh:" } }, @@ -148,7 +148,7 @@ "href": "ssh://me@example.net", "new_value": "gopher", "expected": { - "href": "ssh://me@example.net/", + "href": "ssh://me@example.net", "protocol": "ssh:" } }, @@ -156,7 +156,7 @@ "href": "ssh://me@example.net", "new_value": "file", "expected": { - "href": "ssh://me@example.net/", + "href": "ssh://me@example.net", "protocol": "ssh:" } }, diff --git a/url/urltestdata.json b/url/urltestdata.json index ed9486bfdb4794..29a5a712eefe9b 100644 --- a/url/urltestdata.json +++ b/url/urltestdata.json @@ -553,7 +553,7 @@ { "input": "foo://", "base": "http://example.org/foo/bar", - "href": "foo:///", + "href": "foo://", "origin": "null", "protocol": "foo:", "username": "", @@ -561,7 +561,7 @@ "host": "", "hostname": "", "port": "", - "pathname": "/", + "pathname": "", "search": "", "hash": "" }, From e8bdfc0bc39ebc7b992f631a0dbd64943e41a604 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Sat, 21 Jan 2017 10:53:20 +0100 Subject: [PATCH 4/7] oops --- url/urltestdata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/url/urltestdata.json b/url/urltestdata.json index 29a5a712eefe9b..0a6023ae39a4b7 100644 --- a/url/urltestdata.json +++ b/url/urltestdata.json @@ -4795,7 +4795,7 @@ "host": "", "hostname": "", "port": "", - "pathname": "/", + "pathname": "//", "search": "", "hash": "" }, From 70e9b11ce001c7ac5ebb278053197e1e2c95cb39 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Sat, 21 Jan 2017 17:11:00 +0100 Subject: [PATCH 5/7] test state override --- url/setters_tests.json | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/url/setters_tests.json b/url/setters_tests.json index dcfeb6993fbe65..549034e76b9183 100644 --- a/url/setters_tests.json +++ b/url/setters_tests.json @@ -1278,6 +1278,33 @@ "href": "http://example.net/%3F", "pathname": "/%3F" } + }, + { + "comment": "# needs to be encoded", + "href": "http://example.net", + "new_value": "#", + "expected": { + "href": "http://example.net/%23", + "pathname": "/%23" + } + }, + { + "comment": "? needs to be encoded, non-special scheme", + "href": "sc://example.net", + "new_value": "?", + "expected": { + "href": "sc://example.net/%3F", + "pathname": "/%3F" + } + }, + { + "comment": "# needs to be encoded, non-special scheme", + "href": "sc://example.net", + "new_value": "#", + "expected": { + "href": "sc://example.net/%23", + "pathname": "/%23" + } } ], "search": [ From 13aacc4dfaf56a17d9851d4c5f9145d41eeb7709 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Fri, 27 Jan 2017 15:38:30 +0100 Subject: [PATCH 6/7] this test looks wrong --- url/urltestdata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/url/urltestdata.json b/url/urltestdata.json index 0a6023ae39a4b7..cf487ab38aa0b2 100644 --- a/url/urltestdata.json +++ b/url/urltestdata.json @@ -5025,7 +5025,7 @@ "host": "", "hostname": "", "port": "", - "pathname": "/", + "pathname": "//", "search": "", "hash": "" }, From 4ea8eae2fd807ffd22e84f3c2f2ca12f798f8206 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Fri, 27 Jan 2017 15:43:08 +0100 Subject: [PATCH 7/7] revert oops... --- url/urltestdata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/url/urltestdata.json b/url/urltestdata.json index cf487ab38aa0b2..0ddd5a41a47313 100644 --- a/url/urltestdata.json +++ b/url/urltestdata.json @@ -4795,7 +4795,7 @@ "host": "", "hostname": "", "port": "", - "pathname": "//", + "pathname": "/", "search": "", "hash": "" },