Skip to content

Commit

Permalink
WebSocket: don't throw for bad ports
Browse files Browse the repository at this point in the history
This changed in whatwg/html#840 to improve the
security architecture.

Fixes whatwg/html#2460.
  • Loading branch information
annevk committed Mar 23, 2017
1 parent 13062c6 commit 70ccbba
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions websockets/Create-Secure-blocked-port.htm
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@
<body>
<div id="log"></div>
<script>
test(function () {
// list of bad ports according to
// https://fetch.spec.whatwg.org/#port-blocking
var BLOCKED_PORTS_LIST = [
[
1, // tcpmux
7, // echo
9, // discard
Expand Down Expand Up @@ -77,12 +76,12 @@
6667, // irc (default)
6668, // irc (alternate)
6669, // irc (alternate)
];
for (var i = 0; i < BLOCKED_PORTS_LIST.length; i++) {
var blockedPort = BLOCKED_PORTS_LIST[i];
assert_throws("SECURITY_ERR", function () { CreateWebSocketWithBlockedPort(blockedPort) });
}
}, "W3C WebSocket API - Create Secure WebSocket - Pass a URL with a blocked port - SECURITY_ERR should be thrown")
].forEach(blockedPort => {
async_test(t => {
const ws = CreateWebSocketWithBlockedPort(blockedPort)
ws.onerror = t.step_func_done()
}, "WebSocket blocked port test " + blockedPort)
})
</script>
</body>
</html>

0 comments on commit 70ccbba

Please sign in to comment.