mirror of
https://github.com/servo/servo.git
synced 2025-09-18 10:58:22 +01:00
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:
parent
74ef31cfc4
commit
877c369e0b
25 changed files with 557 additions and 41 deletions
|
@ -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",
|
||||
|
|
|
@ -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>
|
Loading…
Add table
Add a link
Reference in a new issue