Commit c070063b authored by ukai@chromium.org's avatar ukai@chromium.org

2011-03-27 Fumitoshi Ukai <ukai@chromium.org>

        Reviewed by Alexey Proskuryakov.

        Don't call WebSocket::didClose() more than once.
        https://bugs.webkit.org/show_bug.cgi?id=57081

        If WebSocket close() is called, and connection is established, then
        it will call didClose() that resets m_channel to 0.
        After that, when connection is closed, WebSocketChannel will call
        didClose for the WebSocket instance.

        * http/tests/websocket/tests/close-unref-websocket-expected.txt: Added.
        * http/tests/websocket/tests/close-unref-websocket.html: Added.
        * http/tests/websocket/tests/hanging-handshake_wsh.py: Added.
2011-03-27  Fumitoshi Ukai  <ukai@chromium.org>

        Reviewed by Alexey Proskuryakov.

        Don't call WebSocket::didClose() more than once.
        https://bugs.webkit.org/show_bug.cgi?id=57081

        If WebSocket close() is called, and connection is established, then
        it will call didClose() that resets m_channel to 0.
        After that, when connection is closed, WebSocketChannel will call
        didClose for the WebSocket instance.

        Call WebSocketChannel::disconnect() before m_channel = 0 to make sure
        WebSocketChannel suppress the second didClose().

        Test: http/tests/websocket/tests/close-unref-websocket.html

        * websockets/WebSocket.cpp:
        (WebCore::WebSocket::didClose):

git-svn-id: svn://svn.chromium.org/blink/trunk@82088 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 5a95a5f2
2011-03-27 Fumitoshi Ukai <ukai@chromium.org>
Reviewed by Alexey Proskuryakov.
Don't call WebSocket::didClose() more than once.
https://bugs.webkit.org/show_bug.cgi?id=57081
If WebSocket close() is called, and connection is established, then
it will call didClose() that resets m_channel to 0.
After that, when connection is closed, WebSocketChannel will call
didClose for the WebSocket instance.
* http/tests/websocket/tests/close-unref-websocket-expected.txt: Added.
* http/tests/websocket/tests/close-unref-websocket.html: Added.
* http/tests/websocket/tests/hanging-handshake_wsh.py: Added.
2011-03-27 Yuta Kitamura <yutak@chromium.org> 2011-03-27 Yuta Kitamura <yutak@chromium.org>
Unreviewed, add Chromium test results for fast/blockflow/fallback-orientation.html. Unreviewed, add Chromium test results for fast/blockflow/fallback-orientation.html.
......
Test if Web Socket is closed while handshaking and unreferenced, it should fire close event at most once.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS 1 is >= countCloseEvent
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<link rel="stylesheet" href="../../../js-test-resources/js-test-style.css">
<script src="../../../js-test-resources/js-test-pre.js"></script>
<script src="../../../js-test-resources/js-test-post-function.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script type="text/javascript">
description("Test if Web Socket is closed while handshaking and unreferenced, it should fire close event at most once.");
if (window.layoutTestController)
layoutTestController.waitUntilDone();
var countCloseEvent = 0;
function endTest()
{
shouldBeGreaterThanOrEqual("1", "countCloseEvent");
isSuccessfullyParsed();
if (window.layoutTestController)
layoutTestController.notifyDone();
};
var ws = new WebSocket("ws://127.0.0.1:8880/websocket/tests/hanging-handshake");
ws.onclose = function() {
countCloseEvent += 1;
};
ws.close();
ws = null;
gc();
setTimeout("endTest()", 100);
var successfullyParsed = true;
</script>
</body>
</html>
def web_socket_do_extra_handshake(request):
request.connection.read()
def web_socket_transfer_data(request):
pass
2011-03-27 Fumitoshi Ukai <ukai@chromium.org>
Reviewed by Alexey Proskuryakov.
Don't call WebSocket::didClose() more than once.
https://bugs.webkit.org/show_bug.cgi?id=57081
If WebSocket close() is called, and connection is established, then
it will call didClose() that resets m_channel to 0.
After that, when connection is closed, WebSocketChannel will call
didClose for the WebSocket instance.
Call WebSocketChannel::disconnect() before m_channel = 0 to make sure
WebSocketChannel suppress the second didClose().
Test: http/tests/websocket/tests/close-unref-websocket.html
* websockets/WebSocket.cpp:
(WebCore::WebSocket::didClose):
2011-03-27 Adam Barth <abarth@webkit.org> 2011-03-27 Adam Barth <abarth@webkit.org>
Reviewed by Eric Seidel. Reviewed by Eric Seidel.
...@@ -283,7 +283,10 @@ void WebSocket::didClose(unsigned long unhandledBufferedAmount) ...@@ -283,7 +283,10 @@ void WebSocket::didClose(unsigned long unhandledBufferedAmount)
m_bufferedAmountAfterClose += unhandledBufferedAmount; m_bufferedAmountAfterClose += unhandledBufferedAmount;
ASSERT(scriptExecutionContext()); ASSERT(scriptExecutionContext());
dispatchEvent(Event::create(eventNames().closeEvent, false, false)); dispatchEvent(Event::create(eventNames().closeEvent, false, false));
m_channel = 0; if (m_channel) {
m_channel->disconnect();
m_channel = 0;
}
if (hasPendingActivity()) if (hasPendingActivity())
ActiveDOMObject::unsetPendingActivity(this); ActiveDOMObject::unsetPendingActivity(this);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment