blob: ce66a0d274ddd22428afabb288b50e1f9dc0f2ac [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../../../js-test-resources/js-test-pre.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script type="text/javascript">
description('Handshake should fail when the first line does not end with CRLF.');
window.jsTestIsAsync = true;
var connected = false;
let wsOrigin;
function endTest() {
shouldBeFalse('connected');
shouldBeUndefined('wsOrigin');
clearTimeout(timeoutID);
finishJSTest();
}
var url = 'ws://localhost:8880/websocket/tests/hybi/handshake-fail-by-no-cr';
var ws = new WebSocket(url);
ws.onopen = function()
{
debug('Connected');
connected = true;
}
ws.onmessage = function(messageEvent)
{
wsOrigin = messageEvent.data;
debug('wsOrigin = ' + wsOrigin);
ws.close();
}
ws.onclose = function()
{
endTest();
}
function timeoutCallback()
{
debug('Timed out (state = ' + ws.readyState + ')');
endTest();
}
var timeoutID = setTimeout(timeoutCallback, 3000);
</script>
<script src="../../../../js-test-resources/js-test-post.js"></script>
</body>
</html>