<!doctype html>
<title>WebSockets: too few slashes after ws: and wss:</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=../constants.js?pipe=sub></script>
<div id=log></div>
<script>
var tests = [
  ['ws:', PORT],
  ['ws:/', PORT],
  ['wss:', PORT_SSL],
  ['wss:/', PORT_SSL]
];
//Pass condition is to not throw
for (var i = 0; i < tests.length; ++i) {
  test(function(){new WebSocket(tests[i][0] + location.host + ':' + tests[i][1] + '/echo')}, tests[i][0]);
}
</script>

<!doctype html>
<title>WebSockets: too few slashes after ws: and wss:</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=../constants.js?pipe=sub></script>
<div id=log></div>
<script>
var tests = [
  ['ws:', PORT],
  ['ws:/', PORT],
  ['wss:', PORT_SSL],
  ['wss:/', PORT_SSL]
];
//Pass condition is to not throw
for (var i = 0; i < tests.length; ++i) {
  test(function(){new WebSocket(tests[i][0] + location.hostname + ':' + tests[i][1] + '/echo')}, tests[i][0]);
}
</script>

Use hostname rather than host when appending a port manually.
Use hostname rather than host when appending a port manually.

The host attribute returns the port as well as the hostname.
