From 8ec214a2d4f2cbcf6aaf05ebc835e55c4bd16a95 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Tue, 3 Jan 2017 16:25:51 +0100 Subject: [PATCH 1/2] URL: protocol setter and special URLs Closes https://github.com/whatwg/url/issues/104. --- url/setters_tests.json | 44 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/url/setters_tests.json b/url/setters_tests.json index d24f5157f16f214..71953c31e33beed 100644 --- a/url/setters_tests.json +++ b/url/setters_tests.json @@ -102,7 +102,7 @@ } }, { - "comment": "Can’t switch from special scheme to non-special. Note: this may change, see https://github.com/whatwg/url/issues/104", + "comment": "Can’t switch from special scheme to non-special", "href": "http://example.net", "new_value": "b", "expected": { @@ -110,6 +110,22 @@ "protocol": "http:" } }, + { + "href": "https://example.net", + "new_value": "s", + "expected": { + "href": "https://example.net/", + "protocol": "https:" + } + }, + { + "href": "ftp://example.net", + "new_value": "test", + "expected": { + "href": "ftp://example.net/", + "protocol": "ftp:" + } + }, { "comment": "Cannot-be-a-base URL doesn’t have a host, but URL in a special scheme must.", "href": "mailto:me@example.net", @@ -120,7 +136,7 @@ } }, { - "comment": "Can’t switch from non-special scheme to special. Note: this may change, see https://github.com/whatwg/url/issues/104", + "comment": "Can’t switch from non-special scheme to special", "href": "ssh://me@example.net", "new_value": "http", "expected": { @@ -128,6 +144,30 @@ "protocol": "ssh:" } }, + { + "href": "ssh://me@example.net", + "new_value": "gopher", + "expected": { + "href": "ssh://me@example.net/", + "protocol": "ssh:" + } + }, + { + "href": "ssh://me@example.net", + "new_value": "file", + "expected": { + "href": "ssh://me@example.net/", + "protocol": "ssh:" + } + }, + { + "href": "nonsense:///test", + "new_value": "https", + "expected": { + "href": "nonsense:///", + "protocol": "nonsense:" + } + }, { "comment": "Stuff after the first ':' is ignored", "href": "http://example.net", From 1abac85986dd164734f8ce5718d9851af6107c64 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Tue, 3 Jan 2017 18:43:16 +0100 Subject: [PATCH 2/2] fixup --- url/setters_tests.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/url/setters_tests.json b/url/setters_tests.json index 71953c31e33beed..18bc7a6ac52a374 100644 --- a/url/setters_tests.json +++ b/url/setters_tests.json @@ -164,7 +164,7 @@ "href": "nonsense:///test", "new_value": "https", "expected": { - "href": "nonsense:///", + "href": "nonsense:///test", "protocol": "nonsense:" } },