From 9035d5e7a97ebde29d037c14d97b3460a1afe569 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Wed, 11 Jan 2017 07:33:21 +0100 Subject: [PATCH] Test IPv4 part of IPv6 See https://github.com/whatwg/url/issues/195 for context. --- url/setters_tests.json | 92 ++++++++++++++++++++++++++++++++++++++++++ url/urltestdata.json | 30 +++++++++++--- 2 files changed, 117 insertions(+), 5 deletions(-) diff --git a/url/setters_tests.json b/url/setters_tests.json index 55bbc430257e0f..8adb25ce977a8a 100644 --- a/url/setters_tests.json +++ b/url/setters_tests.json @@ -631,6 +631,52 @@ "hostname": "example.com", "port": "" } + }, + { + "comment": "Broken IPv6", + "href": "http://example.net/", + "new_value": "[google.com]", + "expected": { + "href": "http://example.net/", + "host": "example.net", + "hostname": "example.net" + } + }, + { + "href": "http://example.net/", + "new_value": "[::1.2.3.4x]", + "expected": { + "href": "http://example.net/", + "host": "example.net", + "hostname": "example.net" + } + }, + { + "href": "http://example.net/", + "new_value": "[::1.2.3.]", + "expected": { + "href": "http://example.net/", + "host": "example.net", + "hostname": "example.net" + } + }, + { + "href": "http://example.net/", + "new_value": "[::1.2.]", + "expected": { + "href": "http://example.net/", + "host": "example.net", + "hostname": "example.net" + } + }, + { + "href": "http://example.net/", + "new_value": "[::1.]", + "expected": { + "href": "http://example.net/", + "host": "example.net", + "hostname": "example.net" + } } ], "hostname": [ @@ -787,6 +833,52 @@ "hostname": "example.net", "port": "" } + }, + { + "comment": "Broken IPv6", + "href": "http://example.net/", + "new_value": "[google.com]", + "expected": { + "href": "http://example.net/", + "host": "example.net", + "hostname": "example.net" + } + }, + { + "href": "http://example.net/", + "new_value": "[::1.2.3.4x]", + "expected": { + "href": "http://example.net/", + "host": "example.net", + "hostname": "example.net" + } + }, + { + "href": "http://example.net/", + "new_value": "[::1.2.3.]", + "expected": { + "href": "http://example.net/", + "host": "example.net", + "hostname": "example.net" + } + }, + { + "href": "http://example.net/", + "new_value": "[::1.2.]", + "expected": { + "href": "http://example.net/", + "host": "example.net", + "hostname": "example.net" + } + }, + { + "href": "http://example.net/", + "new_value": "[::1.]", + "expected": { + "href": "http://example.net/", + "host": "example.net", + "hostname": "example.net" + } } ], "port": [ diff --git a/url/urltestdata.json b/url/urltestdata.json index cd96644b8e9d39..7644377a2c02cd 100644 --- a/url/urltestdata.json +++ b/url/urltestdata.json @@ -2248,11 +2248,6 @@ "search": "", "hash": "# %C2%BB" }, - { - "input": "http://[www.google.com]/", - "base": "about:blank", - "failure": true - }, { "input": "http://www.google.com", "base": "about:blank", @@ -3689,11 +3684,36 @@ "hash": "" }, "Broken IPv6", + { + "input": "http://[www.google.com]/", + "base": "about:blank", + "failure": true + }, { "input": "http://[google.com]", "base": "http://other.com/", "failure": true }, + { + "input": "http://[::1.2.3.4x]", + "base": "http://other.com/", + "failure": true + }, + { + "input": "http://[::1.2.3.]", + "base": "http://other.com/", + "failure": true + }, + { + "input": "http://[::1.2.]", + "base": "http://other.com/", + "failure": true + }, + { + "input": "http://[::1.]", + "base": "http://other.com/", + "failure": true + }, "Misc Unicode", { "input": "http://foo:💩@example.com/bar",