summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDaijiro Wachi <daijiro.wachi@gmail.com>2017-05-01 17:26:21 +0200
committerDaijiro Wachi <daijiro.wachi@gmail.com>2017-05-01 17:26:21 +0200
commit0f58d3cbefbe744a8e5f9383c08eefc2991b8d1c (patch)
tree21cf9cfa0b48ffc20e45f09b9e1fe822a53c5b4a /test
parent6ed791c665de2c1838f6080a1b377b0008cf535b (diff)
downloadandroid-node-v8-0f58d3cbefbe744a8e5f9383c08eefc2991b8d1c.tar.gz
android-node-v8-0f58d3cbefbe744a8e5f9383c08eefc2991b8d1c.tar.bz2
android-node-v8-0f58d3cbefbe744a8e5f9383c08eefc2991b8d1c.zip
src: support domains with empty labels
Follow the spec of domainToASCII/domainToUnicode in whatwg, and synchronise WPT url test data. Refs: https://github.com/w3c/web-platform-tests/pull/5397 PR-URL: https://github.com/nodejs/node/pull/12707 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/fixtures/url-idna.js19
-rw-r--r--test/fixtures/url-tests.js48
2 files changed, 54 insertions, 13 deletions
diff --git a/test/fixtures/url-idna.js b/test/fixtures/url-idna.js
index af169bb04a..f105adeed1 100644
--- a/test/fixtures/url-idna.js
+++ b/test/fixtures/url-idna.js
@@ -182,23 +182,18 @@ module.exports = {
ascii: 'xn--vitnam-jk8b.icom.museum',
unicode: 'việtnam.icom.museum'
},
- // long URL
- {
- ascii: `${`${'a'.repeat(63)}.`.repeat(3)}com`,
- unicode: `${`${'a'.repeat(63)}.`.repeat(3)}com`
- }
- ],
- invalid: [
// long label
{
- url: `${'a'.repeat(64)}.com`,
- mode: 'ascii'
+ ascii: `${'a'.repeat(64)}.com`,
+ unicode: `${'a'.repeat(64)}.com`,
},
// long URL
{
- url: `${`${'a'.repeat(63)}.`.repeat(4)}com`,
- mode: 'ascii'
- },
+ ascii: `${`${'a'.repeat(64)}.`.repeat(4)}com`,
+ unicode: `${`${'a'.repeat(64)}.`.repeat(4)}com`
+ }
+ ],
+ invalid: [
// invalid character
{
url: '\ufffd.com',
diff --git a/test/fixtures/url-tests.js b/test/fixtures/url-tests.js
index 69d289bd06..355388eaaf 100644
--- a/test/fixtures/url-tests.js
+++ b/test/fixtures/url-tests.js
@@ -1,7 +1,7 @@
'use strict';
/* WPT Refs:
- https://github.com/w3c/web-platform-tests/blob/3eff1bd/url/urltestdata.json
+ https://github.com/w3c/web-platform-tests/blob/3afae94/url/urltestdata.json
License: http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html
*/
module.exports =
@@ -3789,6 +3789,52 @@ module.exports =
"search": "",
"hash": ""
},
+ "Domains with empty labels",
+ {
+ "input": "http://./",
+ "base": "about:blank",
+ "href": "http://./",
+ "origin": "http://.",
+ "protocol": "http:",
+ "username": "",
+ "password": "",
+ "host": ".",
+ "hostname": ".",
+ "port": "",
+ "pathname": "/",
+ "search": "",
+ "hash": ""
+ },
+ {
+ "input": "http://../",
+ "base": "about:blank",
+ "href": "http://../",
+ "origin": "http://..",
+ "protocol": "http:",
+ "username": "",
+ "password": "",
+ "host": "..",
+ "hostname": "..",
+ "port": "",
+ "pathname": "/",
+ "search": "",
+ "hash": ""
+ },
+ {
+ "input": "http://0..0x300/",
+ "base": "about:blank",
+ "href": "http://0..0x300/",
+ "origin": "http://0..0x300",
+ "protocol": "http:",
+ "username": "",
+ "password": "",
+ "host": "0..0x300",
+ "hostname": "0..0x300",
+ "port": "",
+ "pathname": "/",
+ "search": "",
+ "hash": ""
+ },
"Broken IPv6",
{
"input": "http://[www.google.com]/",