WebSocket constructor should not panic

Make an early return when the WebSocket connection fails in the constructor.
Also let the WebSockect connection to be closed when the connection could
not be established.

Fixes #6082.
This commit is contained in:
Jinwoo Song 2015-05-16 14:48:27 +09:00 committed by Ms2ger
parent 74ef31cfc4
commit 877c369e0b
25 changed files with 557 additions and 41 deletions

View file

@ -539,6 +539,12 @@
"url": "/_mozilla/mozilla/union.html"
}
],
"mozilla/websocket_connection_fail.html": [
{
"path": "mozilla/websocket_connection_fail.html",
"url": "/_mozilla/mozilla/websocket_connection_fail.html"
}
],
"mozilla/window.html": [
{
"path": "mozilla/window.html",

View file

@ -0,0 +1,19 @@
<html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script>
async_test(function() {
var onclose = 0;
var ws = new WebSocket("ws://wrong_url");
ws.onclose = this.step_func_done(function(ev) {
onclose++;
assert_equals(onclose, 1);
});
});
</script>
</body>
</html>