From 1e1e80441b8d6a60f836de4005dba25698ecfe4a Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Tue, 3 Jan 2017 23:07:50 +0100 Subject: [PATCH] URL: protocol setter and special URLs (#4413) * 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 62ed3a5c372b99..55bbc430257e0f 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:///test", + "protocol": "nonsense:" + } + }, { "comment": "Stuff after the first ':' is ignored", "href": "http://example.net",