Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
2010-03-05 Fumitoshi Ukai <ukai@chromium.org>
Reviewed by Alexey Proskuryakov. WebSocket onmessageerror event handler https://bugs.webkit.org/show_bug.cgi?id=35570 * websocket/tests/error-detect-expected.txt: Added. * websocket/tests/error-detect.html: Added. * websocket/tests/script-tests/error-detect.js: Added. * websocket/tests/unknown-frame-type_wsh.py: Added. 2010-03-05 Fumitoshi Ukai <ukai@chromium.org> Reviewed by Alexey Proskuryakov. WebSocket onmessageerror event handler https://bugs.webkit.org/show_bug.cgi?id=35570 Test: websocket/tests/error-detect.html * websockets/WebSocket.cpp: (WebCore::WebSocketChannel::didConnect): assert scriptExecutionContext. (WebCore::WebSocketChannel::didReceiveMessage): assert scriptExecutionContext. (WebCore::WebSocket::didReceiveMessageError): (WebCore::WebSocket::didClose): assert scriptExecutionContext. * websockets/WebSocket.h: * websockets/WebSocket.idl: Add onerror event listener * websockets/WebSocketChannel.cpp: (WebCore::WebSocketChannel::didReceiveData): call didReceiveMessageError if unknown frame tye is detected, or frame length overflowed. * websockets/WebSocketChannelClient.h: (WebCore::WebSocketChannelClient::didReceiveMessageError): Canonical link: https://commits.webkit.org/46870@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@55573 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Fumitoshi Ukai
committed
Mar 5, 2010
1 parent
15191f4
commit 936fca087b407dabfe22e1b15bd848c6e2e5af53
Showing
11 changed files
with
125 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,12 @@ | ||
Make sure WebSocket correctly fire error event for unknown frame type. | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
WebSocket is open | ||
received:done | ||
WebSocket is closed | ||
PASS errorCount is 255 | ||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,13 @@ | ||
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | ||
<html> | ||
<head> | ||
<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css"> | ||
<script src="../../fast/js/resources/js-test-pre.js"></script> | ||
<script src="../../fast/js/resources/js-test-post-function.js"></script> | ||
</head> | ||
<body> | ||
<div id="description"></div> | ||
<div id="console"></div> | ||
<script src="script-tests/error-detect.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,29 @@ | ||
description("Make sure WebSocket correctly fire error event for unknown frame type."); | ||
if (window.layoutTestController) | ||
layoutTestController.waitUntilDone(); | ||
|
||
var errorCount = 0; | ||
|
||
function finish() { | ||
shouldBe("errorCount", "255"); | ||
isSuccessfullyParsed(); | ||
if (window.layoutTestController) | ||
layoutTestController.notifyDone(); | ||
} | ||
|
||
var ws = new WebSocket("ws://127.0.0.1:8880/websocket/tests/unknown-frame-type"); | ||
ws.onopen = function () { | ||
debug("WebSocket is open"); | ||
}; | ||
ws.onmessage = function (evt) { | ||
debug("received:" + evt.data); | ||
}; | ||
ws.onerror = function () { | ||
errorCount += 1; | ||
}; | ||
ws.onclose = function () { | ||
debug("WebSocket is closed"); | ||
finish(); | ||
}; | ||
|
||
var successfullyParsed = true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,12 @@ | ||
from mod_pywebsocket import msgutil | ||
|
||
def web_socket_do_extra_handshake(request): | ||
pass | ||
|
||
def web_socket_transfer_data(request): | ||
for i in range(1, 128): | ||
request.connection.write(chr(i) + str(i) + '\xff') | ||
for i in range(128, 256): | ||
msg = str(i) | ||
request.connection.write(chr(i) + chr(len(msg)) + msg) | ||
msgutil.send_message(request, 'done') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters