From 094fcd4dd2b881a7f751f9c1f55534cbe08b151f Mon Sep 17 00:00:00 2001 From: Alwin Blok Date: Tue, 22 Sep 2020 14:42:30 +0200 Subject: [PATCH 1/2] Changes to URL tests for WhatWG URL Standard, issue 405 --- url/resources/setters_tests.json | 12 +- url/resources/urltestdata.json | 239 +++++++++++++++++++++++-------- 2 files changed, 189 insertions(+), 62 deletions(-) diff --git a/url/resources/setters_tests.json b/url/resources/setters_tests.json index d06fb2cfe629b8..8aa74d6b8a28d9 100644 --- a/url/resources/setters_tests.json +++ b/url/resources/setters_tests.json @@ -1672,8 +1672,8 @@ "href": "file://monkey/", "new_value": "\\\\", "expected": { - "href": "file://monkey/", - "pathname": "/" + "href": "file://monkey//", + "pathname": "//" } }, { @@ -1681,8 +1681,8 @@ "href": "file:///unicorn", "new_value": "//\\/", "expected": { - "href": "file:///", - "pathname": "/" + "href": "file://////", + "pathname": "////" } }, { @@ -1690,8 +1690,8 @@ "href": "file:///unicorn", "new_value": "//monkey/..//", "expected": { - "href": "file:///", - "pathname": "/" + "href": "file://///", + "pathname": "///" } }, { diff --git a/url/resources/urltestdata.json b/url/resources/urltestdata.json index 76a8b3a015dcbc..7ef0eab435238c 100644 --- a/url/resources/urltestdata.json +++ b/url/resources/urltestdata.json @@ -5389,84 +5389,84 @@ { "input": "file:\\\\//", "base": "about:blank", - "href": "file:///", + "href": "file:////", "protocol": "file:", "username": "", "password": "", "host": "", "hostname": "", "port": "", - "pathname": "/", + "pathname": "//", "search": "", "hash": "" }, { "input": "file:\\\\\\\\", "base": "about:blank", - "href": "file:///", + "href": "file:////", "protocol": "file:", "username": "", "password": "", "host": "", "hostname": "", "port": "", - "pathname": "/", + "pathname": "//", "search": "", "hash": "" }, { "input": "file:\\\\\\\\?fox", "base": "about:blank", - "href": "file:///?fox", + "href": "file:////?fox", "protocol": "file:", "username": "", "password": "", "host": "", "hostname": "", "port": "", - "pathname": "/", + "pathname": "//", "search": "?fox", "hash": "" }, { "input": "file:\\\\\\\\#guppy", "base": "about:blank", - "href": "file:///#guppy", + "href": "file:////#guppy", "protocol": "file:", "username": "", "password": "", "host": "", "hostname": "", "port": "", - "pathname": "/", + "pathname": "//", "search": "", "hash": "#guppy" }, { "input": "file://spider///", "base": "about:blank", - "href": "file://spider/", + "href": "file://spider///", "protocol": "file:", "username": "", "password": "", "host": "spider", "hostname": "spider", "port": "", - "pathname": "/", + "pathname": "///", "search": "", "hash": "" }, { "input": "file:\\\\localhost//", "base": "about:blank", - "href": "file:///", + "href": "file:////", "protocol": "file:", "username": "", "password": "", "host": "", "hostname": "", "port": "", - "pathname": "/", + "pathname": "//", "search": "", "hash": "" }, @@ -5487,42 +5487,42 @@ { "input": "file://\\/localhost//cat", "base": "about:blank", - "href": "file:///localhost//cat", + "href": "file:////localhost//cat", "protocol": "file:", "username": "", "password": "", "host": "", "hostname": "", "port": "", - "pathname": "/localhost//cat", + "pathname": "//localhost//cat", "search": "", "hash": "" }, { "input": "file://localhost//a//../..//", "base": "about:blank", - "href": "file:///", + "href": "file://///", "protocol": "file:", "username": "", "password": "", "host": "", "hostname": "", "port": "", - "pathname": "/", + "pathname": "///", "search": "", "hash": "" }, { "input": "/////mouse", "base": "file:///elephant", - "href": "file:///mouse", + "href": "file://///mouse", "protocol": "file:", "username": "", "password": "", "host": "", "hostname": "", "port": "", - "pathname": "/mouse", + "pathname": "///mouse", "search": "", "hash": "" }, @@ -5543,42 +5543,42 @@ { "input": "\\/localhost//pig", "base": "file://lion/", - "href": "file:///pig", + "href": "file:////pig", "protocol": "file:", "username": "", "password": "", "host": "", "hostname": "", "port": "", - "pathname": "/pig", + "pathname": "//pig", "search": "", "hash": "" }, { "input": "//localhost//pig", "base": "file://lion/", - "href": "file:///pig", + "href": "file:////pig", "protocol": "file:", "username": "", "password": "", "host": "", "hostname": "", "port": "", - "pathname": "/pig", + "pathname": "//pig", "search": "", "hash": "" }, { "input": "/..//localhost//pig", "base": "file://lion/", - "href": "file://lion/localhost//pig", + "href": "file://lion//localhost//pig", "protocol": "file:", "username": "", "password": "", "host": "lion", "hostname": "lion", "port": "", - "pathname": "/localhost//pig", + "pathname": "//localhost//pig", "search": "", "hash": "" }, @@ -5629,12 +5629,12 @@ { "input": "C|", "base": "file://host/dir/file", - "href": "file:///C:", + "href": "file://host/C:", "protocol": "file:", "username": "", "password": "", - "host": "", - "hostname": "", + "host": "host", + "hostname": "host", "port": "", "pathname": "/C:", "search": "", @@ -5643,12 +5643,12 @@ { "input": "C|#", "base": "file://host/dir/file", - "href": "file:///C:#", + "href": "file://host/C:#", "protocol": "file:", "username": "", "password": "", - "host": "", - "hostname": "", + "host": "host", + "hostname": "host", "port": "", "pathname": "/C:", "search": "", @@ -5657,12 +5657,12 @@ { "input": "C|?", "base": "file://host/dir/file", - "href": "file:///C:?", + "href": "file://host/C:?", "protocol": "file:", "username": "", "password": "", - "host": "", - "hostname": "", + "host": "host", + "hostname": "host", "port": "", "pathname": "/C:", "search": "", @@ -5671,12 +5671,12 @@ { "input": "C|/", "base": "file://host/dir/file", - "href": "file:///C:/", + "href": "file://host/C:/", "protocol": "file:", "username": "", "password": "", - "host": "", - "hostname": "", + "host": "host", + "hostname": "host", "port": "", "pathname": "/C:/", "search": "", @@ -5685,12 +5685,12 @@ { "input": "C|\n/", "base": "file://host/dir/file", - "href": "file:///C:/", + "href": "file://host/C:/", "protocol": "file:", "username": "", "password": "", - "host": "", - "hostname": "", + "host": "host", + "hostname": "host", "port": "", "pathname": "/C:/", "search": "", @@ -5699,12 +5699,12 @@ { "input": "C|\\", "base": "file://host/dir/file", - "href": "file:///C:/", + "href": "file://host/C:/", "protocol": "file:", "username": "", "password": "", - "host": "", - "hostname": "", + "host": "host", + "hostname": "host", "port": "", "pathname": "/C:/", "search": "", @@ -5784,27 +5784,27 @@ { "input": "/c:/foo/bar", "base": "file://host/path", - "href": "file:///c:/foo/bar", + "href": "file://host/c:/foo/bar", "protocol": "file:", "username": "", "password": "", - "host": "", - "hostname": "", + "host": "host", + "hostname": "host", "port": "", "pathname": "/c:/foo/bar", "search": "", "hash": "" }, - "# Windows drive letter quirk with not empty host", + "# Do not drop the host in the presence of a drive letter", { "input": "file://example.net/C:/", "base": "about:blank", - "href": "file:///C:/", + "href": "file://example.net/C:/", "protocol": "file:", "username": "", "password": "", - "host": "", - "hostname": "", + "host": "example.net", + "hostname": "example.net", "port": "", "pathname": "/C:/", "search": "", @@ -5813,12 +5813,12 @@ { "input": "file://1.2.3.4/C:/", "base": "about:blank", - "href": "file:///C:/", + "href": "file://1.2.3.4/C:/", "protocol": "file:", "username": "", "password": "", - "host": "", - "hostname": "", + "host": "1.2.3.4", + "hostname": "1.2.3.4", "port": "", "pathname": "/C:/", "search": "", @@ -5827,12 +5827,12 @@ { "input": "file://[1::8]/C:/", "base": "about:blank", - "href": "file:///C:/", + "href": "file://[1::8]/C:/", "protocol": "file:", "username": "", "password": "", - "host": "", - "hostname": "", + "host": "[1::8]", + "hostname": "[1::8]", "port": "", "pathname": "/C:/", "search": "", @@ -6034,6 +6034,133 @@ "base": "about:blank", "failure": true }, + "# Additional file URL tetsts for (https://github.com/whatwg/url/issues/405)", + { + "input": "file://localhost//a//../..//foo", + "base": "about:blank", + "href": "file://///foo", + "protocol": "file:", + "username": "", + "password": "", + "host": "", + "hostname": "", + "port": "", + "pathname": "///foo", + "search": "", + "hash": "" + }, + { + "input": "file://localhost////foo", + "base": "about:blank", + "href": "file://////foo", + "protocol": "file:", + "username": "", + "password": "", + "host": "", + "hostname": "", + "port": "", + "pathname": "////foo", + "search": "", + "hash": "" + }, + { + "input": "file:////foo", + "base": "about:blank", + "href": "file:////foo", + "protocol": "file:", + "username": "", + "password": "", + "host": "", + "hostname": "", + "port": "", + "pathname": "//foo", + "search": "", + "hash": "" + }, + { + "input": "file:///one/two", + "base": "file:///", + "href": "file:///one/two", + "protocol": "file:", + "username": "", + "password": "", + "host": "", + "hostname": "", + "port": "", + "pathname": "/one/two", + "search": "", + "hash": "" + }, + { + "input": "file:////one/two", + "base": "file:///", + "href": "file:////one/two", + "protocol": "file:", + "username": "", + "password": "", + "host": "", + "hostname": "", + "port": "", + "pathname": "//one/two", + "search": "", + "hash": "" + }, + { + "input": "//one/two", + "base": "file:///", + "href": "file://one/two", + "protocol": "file:", + "username": "", + "password": "", + "host": "one", + "hostname": "one", + "port": "", + "pathname": "/two", + "search": "", + "hash": "" + }, + { + "input": "///one/two", + "base": "file:///", + "href": "file:///one/two", + "protocol": "file:", + "username": "", + "password": "", + "host": "", + "hostname": "", + "port": "", + "pathname": "/one/two", + "search": "", + "hash": "" + }, + { + "input": "////one/two", + "base": "file:///", + "href": "file:////one/two", + "protocol": "file:", + "username": "", + "password": "", + "host": "", + "hostname": "", + "port": "", + "pathname": "//one/two", + "search": "", + "hash": "" + }, + { + "input": "file:///.//", + "base": "file:////", + "href": "file:////", + "protocol": "file:", + "username": "", + "password": "", + "host": "", + "hostname": "", + "port": "", + "pathname": "//", + "search": "", + "hash": "" + }, "# IPv6 tests", { "input": "http://[1:0::]", @@ -7217,4 +7344,4 @@ "search": "", "username": "user" } -] +] \ No newline at end of file From 1252b80ec01c2fc659028a10d4c70a81153d9279 Mon Sep 17 00:00:00 2001 From: Alwin Blok Date: Mon, 28 Sep 2020 17:06:15 +0200 Subject: [PATCH 2/2] Restore the newline at the end of urltestdata.json --- url/resources/urltestdata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/url/resources/urltestdata.json b/url/resources/urltestdata.json index 7ef0eab435238c..dba7237d88a682 100644 --- a/url/resources/urltestdata.json +++ b/url/resources/urltestdata.json @@ -7344,4 +7344,4 @@ "search": "", "username": "user" } -] \ No newline at end of file +]