From e8aa61d80e3971489ace4355ee970d30c09b615e Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Fri, 17 Feb 2017 14:07:35 +0100 Subject: [PATCH] URL: test setters with javascript URLs See https://github.com/whatwg/url/pull/254 and https://github.com/whatwg/html/pull/2371 for changes to the standards. --- url/setters_tests.json | 48 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/url/setters_tests.json b/url/setters_tests.json index 77b82f59b31bf7..dbe7f777733393 100644 --- a/url/setters_tests.json +++ b/url/setters_tests.json @@ -39,6 +39,14 @@ "protocol": "b:" } }, + { + "href": "javascript:alert(1)", + "new_value": "defuse", + "expected": { + "href": "defuse:alert(1)", + "protocol": "defuse:" + } + }, { "comment": "Upper-case ASCII is lower-cased", "href": "a://example.net", @@ -215,6 +223,14 @@ "username": "" } }, + { + "href": "javascript:alert(1)", + "new_value": "wario", + "expected": { + "href": "javascript:alert(1)", + "username": "" + } + }, { "href": "http://example.net", "new_value": "me", @@ -273,6 +289,14 @@ "username": "" } }, + { + "href": "javascript://x/", + "new_value": "wario", + "expected": { + "href": "javascript://wario@x/", + "username": "wario" + } + }, { "href": "file://test/", "new_value": "test", @@ -368,6 +392,14 @@ "password": "" } }, + { + "href": "javascript://x/", + "new_value": "bowser", + "expected": { + "href": "javascript://:bowser@x/", + "password": "bowser" + } + }, { "href": "file://test/", "new_value": "test", @@ -1389,6 +1421,14 @@ "href": "sc://x:12/", "port": "12" } + }, + { + "href": "javascript://x/", + "new_value": "12", + "expected": { + "href": "javascript://x:12/", + "port": "12" + } } ], "pathname": [ @@ -1648,6 +1688,14 @@ "href": "http://example.net/#%c3%89t%C3%A9", "hash": "#%c3%89t%C3%A9" } + }, + { + "href": "javascript:alert(1)", + "new_value": "castle", + "expected": { + "href": "javascript:alert(1)#castle", + "hash": "#castle" + } } ] }