Index: third_party/WebKit/LayoutTests/imported/wpt/common/get-host-info.sub.js |
diff --git a/third_party/WebKit/LayoutTests/imported/wpt/common/get-host-info.sub.js b/third_party/WebKit/LayoutTests/imported/wpt/common/get-host-info.sub.js |
index 8d3d61de12a71f414d3662313fb9c72b685ea64c..5e60c49767b41df41035fc46eed02909e698839b 100644 |
--- a/third_party/WebKit/LayoutTests/imported/wpt/common/get-host-info.sub.js |
+++ b/third_party/WebKit/LayoutTests/imported/wpt/common/get-host-info.sub.js |
@@ -23,3 +23,13 @@ function get_host_info() { |
HTTPS_REMOTE_ORIGIN_WITH_CREDS: 'https://foo:bar@' + REMOTE_HOST + ':' + HTTPS_PORT, |
}; |
} |
+ |
+function get_port(loc) { |
+ // When a default port is used, location.port returns the empty string. |
+ // To compare with wptserve `ports` substitution we need a port... |
+ // loc can be Location/<a>/<area>/URL, but assumes http/https only. |
+ if (loc.port) { |
+ return loc.port; |
+ } |
+ return loc.protocol === 'https:' ? '443' : '80'; |
+} |