Skip to content

Commit 70cdfc5

Browse files
TimothyGujasnell
authored andcommitted
url: expose WHATWG url.origin as ASCII
PR-URL: #13126 Refs: whatwg/url#297 Refs: web-platform-tests/wpt#5944 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Daijiro Wachi <[email protected]> Reviewed-By: Joyee Cheung <[email protected]>
1 parent 4fa2ee1 commit 70cdfc5

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

lib/internal/url.js

+3-6
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,9 @@ function toUSVString(val) {
6565
// Refs: https://html.spec.whatwg.org/multipage/browsers.html#concept-origin-opaque
6666
const kOpaqueOrigin = 'null';
6767

68-
// Refs:
69-
// - https://html.spec.whatwg.org/multipage/browsers.html#unicode-serialisation-of-an-origin
70-
// - https://html.spec.whatwg.org/multipage/browsers.html#ascii-serialisation-of-an-origin
71-
function serializeTupleOrigin(scheme, host, port, unicode = true) {
72-
const unicodeHost = unicode ? domainToUnicode(host) : host;
73-
return `${scheme}//${unicodeHost}${port === null ? '' : `:${port}`}`;
68+
// Refs: https://html.spec.whatwg.org/multipage/browsers.html#ascii-serialisation-of-an-origin
69+
function serializeTupleOrigin(scheme, host, port) {
70+
return `${scheme}//${host}${port === null ? '' : `:${port}`}`;
7471
}
7572

7673
// This class provides the internal state of a URL object. An instance of this

test/fixtures/url-tests.js

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
/* WPT Refs:
4-
https://github.com/w3c/web-platform-tests/blob/0f26c418a5/url/urltestdata.json
4+
https://github.com/w3c/web-platform-tests/blob/8df7c9c215/url/urltestdata.json
55
License: http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html
66
*/
77
module.exports =
@@ -3679,7 +3679,7 @@ module.exports =
36793679
"input": "http://你好你好",
36803680
"base": "http://other.com/",
36813681
"href": "http://xn--6qqa088eba/",
3682-
"origin": "http://你好你好",
3682+
"origin": "http://xn--6qqa088eba",
36833683
"protocol": "http:",
36843684
"username": "",
36853685
"password": "",
@@ -3694,7 +3694,7 @@ module.exports =
36943694
"input": "https://faß.ExAmPlE/",
36953695
"base": "about:blank",
36963696
"href": "https://xn--fa-hia.example/",
3697-
"origin": "https://faß.example",
3697+
"origin": "https://xn--fa-hia.example",
36983698
"protocol": "https:",
36993699
"username": "",
37003700
"password": "",
@@ -3709,6 +3709,7 @@ module.exports =
37093709
"input": "sc://faß.ExAmPlE/",
37103710
"base": "about:blank",
37113711
"href": "sc://fa%C3%9F.ExAmPlE/",
3712+
"origin": "null",
37123713
"protocol": "sc:",
37133714
"username": "",
37143715
"password": "",
@@ -4617,7 +4618,7 @@ module.exports =
46174618
"input": "ftp://%e2%98%83",
46184619
"base": "about:blank",
46194620
"href": "ftp://xn--n3h/",
4620-
"origin": "ftp://",
4621+
"origin": "ftp://xn--n3h",
46214622
"protocol": "ftp:",
46224623
"username": "",
46234624
"password": "",
@@ -4632,7 +4633,7 @@ module.exports =
46324633
"input": "https://%e2%98%83",
46334634
"base": "about:blank",
46344635
"href": "https://xn--n3h/",
4635-
"origin": "https://",
4636+
"origin": "https://xn--n3h",
46364637
"protocol": "https:",
46374638
"username": "",
46384639
"password": "",

0 commit comments

Comments
 (0)