0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-30 07:27:22 +01:00

url: expose WHATWG url.origin as ASCII

PR-URL: https://github.com/nodejs/node/pull/13126
Refs: https://github.com/whatwg/url/issues/297
Refs: https://github.com/w3c/web-platform-tests/pull/5944
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
This commit is contained in:
Timothy Gu 2017-05-20 00:52:52 -07:00
parent 6caf1b093a
commit 413691fde0
No known key found for this signature in database
GPG Key ID: 7FE6B095B582B0D4
2 changed files with 9 additions and 11 deletions

View File

@ -65,12 +65,9 @@ function toUSVString(val) {
// Refs: https://html.spec.whatwg.org/multipage/browsers.html#concept-origin-opaque
const kOpaqueOrigin = 'null';
// Refs:
// - https://html.spec.whatwg.org/multipage/browsers.html#unicode-serialisation-of-an-origin
// - https://html.spec.whatwg.org/multipage/browsers.html#ascii-serialisation-of-an-origin
function serializeTupleOrigin(scheme, host, port, unicode = true) {
const unicodeHost = unicode ? domainToUnicode(host) : host;
return `${scheme}//${unicodeHost}${port === null ? '' : `:${port}`}`;
// Refs: https://html.spec.whatwg.org/multipage/browsers.html#ascii-serialisation-of-an-origin
function serializeTupleOrigin(scheme, host, port) {
return `${scheme}//${host}${port === null ? '' : `:${port}`}`;
}
// This class provides the internal state of a URL object. An instance of this

View File

@ -1,7 +1,7 @@
'use strict';
/* WPT Refs:
https://github.com/w3c/web-platform-tests/blob/0f26c418a5/url/urltestdata.json
https://github.com/w3c/web-platform-tests/blob/8df7c9c215/url/urltestdata.json
License: http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html
*/
module.exports =
@ -3679,7 +3679,7 @@ module.exports =
"input": "http://你好你好",
"base": "http://other.com/",
"href": "http://xn--6qqa088eba/",
"origin": "http://你好你好",
"origin": "http://xn--6qqa088eba",
"protocol": "http:",
"username": "",
"password": "",
@ -3694,7 +3694,7 @@ module.exports =
"input": "https://faß.ExAmPlE/",
"base": "about:blank",
"href": "https://xn--fa-hia.example/",
"origin": "https://faß.example",
"origin": "https://xn--fa-hia.example",
"protocol": "https:",
"username": "",
"password": "",
@ -3709,6 +3709,7 @@ module.exports =
"input": "sc://faß.ExAmPlE/",
"base": "about:blank",
"href": "sc://fa%C3%9F.ExAmPlE/",
"origin": "null",
"protocol": "sc:",
"username": "",
"password": "",
@ -4617,7 +4618,7 @@ module.exports =
"input": "ftp://%e2%98%83",
"base": "about:blank",
"href": "ftp://xn--n3h/",
"origin": "ftp://",
"origin": "ftp://xn--n3h",
"protocol": "ftp:",
"username": "",
"password": "",
@ -4632,7 +4633,7 @@ module.exports =
"input": "https://%e2%98%83",
"base": "about:blank",
"href": "https://xn--n3h/",
"origin": "https://",
"origin": "https://xn--n3h",
"protocol": "https:",
"username": "",
"password": "",