| Differences between
and this patch
- a/Source/WebCore/ChangeLog +15 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2013-04-08  Lamarque V. Souza  <Lamarque.Souza@basyskom.com>
2
3
        [WebSocket] Ignore incoming message in CLOSING state
4
        https://bugs.webkit.org/show_bug.cgi?id=85934
5
6
        Reviewed by Kent Tamura.
7
8
        Change WebSocket implementation to suit the new WebSocket API, which
9
        states that we should ignore messages in CLOSING state.
10
11
        No new tests, updating existing tests.
12
13
        * Modules/websockets/WebSocket.cpp:
14
        (WebCore::WebSocket::didReceiveMessage):
15
1
2013-04-08  Andrei Bucur  <abucur@adobe.com>
16
2013-04-08  Andrei Bucur  <abucur@adobe.com>
2
17
3
        Simplify ContainerNode::removeChildren
18
        Simplify ContainerNode::removeChildren
- a/Source/WebCore/Modules/websockets/WebSocket.cpp -1 / +1 lines
Lines 513-519 void WebSocket::didConnect() a/Source/WebCore/Modules/websockets/WebSocket.cpp_sec1
513
void WebSocket::didReceiveMessage(const String& msg)
513
void WebSocket::didReceiveMessage(const String& msg)
514
{
514
{
515
    LOG(Network, "WebSocket %p didReceiveMessage() Text message '%s'", this, msg.utf8().data());
515
    LOG(Network, "WebSocket %p didReceiveMessage() Text message '%s'", this, msg.utf8().data());
516
    if (m_state != OPEN && m_state != CLOSING)
516
    if (m_state != OPEN)
517
        return;
517
        return;
518
    ASSERT(scriptExecutionContext());
518
    ASSERT(scriptExecutionContext());
519
    dispatchEvent(MessageEvent::create(msg, SecurityOrigin::create(m_url)->toString()));
519
    dispatchEvent(MessageEvent::create(msg, SecurityOrigin::create(m_url)->toString()));
- a/LayoutTests/ChangeLog +19 lines
Lines 1-3 a/LayoutTests/ChangeLog_sec1
1
2013-04-08  Lamarque V. Souza  <Lamarque.Souza@basyskom.com>
2
3
        [WebSocket] Ignore incoming message in CLOSING state
4
        https://bugs.webkit.org/show_bug.cgi?id=85934
5
6
        Need a short description (OOPS!).
7
        Need the bug URL (OOPS!).
8
9
        Reviewed by Kent Tamura.
10
11
        * http/tests/websocket/tests/hybi/client-close-expected.txt: Rebaseline.
12
        * http/tests/websocket/tests/hybi/client-close.html: Change expected results.
13
        * http/tests/websocket/tests/hybi/client-close_wsh.py: Embed message in close frame
14
        instead of using regular message sending call.
15
        * http/tests/websocket/tests/hybi/fragmented-frames.html: Call WebSocket.close()
16
        only after receiving all messages from server.
17
        * http/tests/websocket/tests/hybi/unmasked-frames.html: Remove extra
18
        WebSocket.close() call that caused regression.
19
1
2013-04-08  Jer Noble  <jer.noble@apple.com>
20
2013-04-08  Jer Noble  <jer.noble@apple.com>
2
21
3
        Unreviewed gardening. Remove expected results added by r147824.
22
        Unreviewed gardening. Remove expected results added by r147824.
- a/LayoutTests/http/tests/websocket/tests/hybi/client-close-expected.txt -3 / +3 lines
Lines 1-11 a/LayoutTests/http/tests/websocket/tests/hybi/client-close-expected.txt_sec1
1
WebSocket: Test client-initiated close.
1
WebSocket: Test client-initiated close. After WebSocket.close() any message from server must be discarded by WebSocket stack according to the new WebSocket API. See http://webkit.org/b/85934.
2
2
3
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
3
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
4
4
5
Connected
5
Connected
6
Received: close_frame[:2]='\x88\x80'
7
Closed
6
Closed
8
PASS receivedMessage is "close_frame[:2]='\\x88\\x80'"
7
PASS receivedMessage is undefined.
8
PASS closeEvent.reason is "close_frame[:2]='\\x88\\x80'"
9
PASS closeEvent.wasClean is true
9
PASS closeEvent.wasClean is true
10
PASS successfullyParsed is true
10
PASS successfullyParsed is true
11
11
- a/LayoutTests/http/tests/websocket/tests/hybi/client-close.html -5 / +6 lines
Lines 1-13 a/LayoutTests/http/tests/websocket/tests/hybi/client-close.html_sec1
1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
1
<!DOCTYPE HTML>
2
<html>
2
<html>
3
<head>
3
<head>
4
<script src="../../../../js-test-resources/js-test-pre.js"></script>
4
<script src="/js-test-resources/js-test-pre.js"></script>
5
</head>
5
</head>
6
<body>
6
<body>
7
<div id="description"></div>
7
<div id="description"></div>
8
<div id="console"></div>
8
<div id="console"></div>
9
<script type="text/javascript">
9
<script type="text/javascript">
10
description("WebSocket: Test client-initiated close.");
10
description("WebSocket: Test client-initiated close. After WebSocket.close() any message from server must be discarded by WebSocket stack according to the new WebSocket API. See http://webkit.org/b/85934.");
11
11
12
window.jsTestIsAsync = true;
12
window.jsTestIsAsync = true;
13
13
Lines 23-29 ws.onopen = function() a/LayoutTests/http/tests/websocket/tests/hybi/client-close.html_sec2
23
23
24
ws.onmessage = function(messageEvent)
24
ws.onmessage = function(messageEvent)
25
{
25
{
26
    debug("Received: " + messageEvent.data);
26
    debug("Message should have been ignored: " + messageEvent.data);
27
    receivedMessage = messageEvent.data;
27
    receivedMessage = messageEvent.data;
28
};
28
};
29
29
Lines 31-37 ws.onclose = function(event) a/LayoutTests/http/tests/websocket/tests/hybi/client-close.html_sec3
31
{
31
{
32
    debug("Closed");
32
    debug("Closed");
33
    closeEvent = event;
33
    closeEvent = event;
34
    shouldBeEqualToString("receivedMessage", "close_frame[:2]='\\x88\\x80'");
34
    shouldBeUndefined("receivedMessage");
35
    shouldBeEqualToString("closeEvent.reason", "close_frame[:2]='\\x88\\x80'");
35
    shouldBeTrue("closeEvent.wasClean");
36
    shouldBeTrue("closeEvent.wasClean");
36
    finishJSTest();
37
    finishJSTest();
37
};
38
};
- a/LayoutTests/http/tests/websocket/tests/hybi/client-close_wsh.py -2 / +7 lines
Lines 1-5 a/LayoutTests/http/tests/websocket/tests/hybi/client-close_wsh.py_sec1
1
from mod_pywebsocket import msgutil
1
import struct
2
2
3
from mod_pywebsocket import msgutil
4
from mod_pywebsocket import stream
3
5
4
def web_socket_do_extra_handshake(request):
6
def web_socket_do_extra_handshake(request):
5
    pass
7
    pass
Lines 9-17 def web_socket_transfer_data(request): a/LayoutTests/http/tests/websocket/tests/hybi/client-close_wsh.py_sec2
9
    # Wait for a close frame sent from the client.
11
    # Wait for a close frame sent from the client.
10
    close_frame = request.ws_stream.receive_bytes(6)
12
    close_frame = request.ws_stream.receive_bytes(6)
11
13
14
    msgutil.send_message(request, 'Client should ignore this message')
15
12
    # Send only first two bytes of the received frame. The remaining four bytes are
16
    # Send only first two bytes of the received frame. The remaining four bytes are
13
    # "masking key", which changes every time the test runs.
17
    # "masking key", which changes every time the test runs.
14
    msgutil.send_message(request, 'close_frame[:2]=%r' % close_frame[:2])
18
    data = struct.pack('!H', 1000) + 'close_frame[:2]=%r' % close_frame[:2]
19
    request.connection.write(stream.create_close_frame(data))
15
20
16
    # If the following assertion fails, AssertionError will be raised,
21
    # If the following assertion fails, AssertionError will be raised,
17
    # which will prevent pywebsocket from sending a close frame.
22
    # which will prevent pywebsocket from sending a close frame.
- a/LayoutTests/http/tests/websocket/tests/hybi/fragmented-frames.html -2 / +4 lines
Lines 1-7 a/LayoutTests/http/tests/websocket/tests/hybi/fragmented-frames.html_sec1
1
<!DOCTYPE HTML>
1
<!DOCTYPE HTML>
2
<html>
2
<html>
3
<head>
3
<head>
4
<script src="../../../../js-test-resources/js-test-pre.js"></script>
4
<script src="/js-test-resources/js-test-pre.js"></script>
5
</head>
5
</head>
6
<body>
6
<body>
7
<div id="description"></div>
7
<div id="description"></div>
Lines 20-26 var actualMessages = []; a/LayoutTests/http/tests/websocket/tests/hybi/fragmented-frames.html_sec2
20
ws.onopen = function()
20
ws.onopen = function()
21
{
21
{
22
    debug("onopen() was called.");
22
    debug("onopen() was called.");
23
    ws.close();
24
};
23
};
25
24
26
ws.onmessage = function(event)
25
ws.onmessage = function(event)
Lines 28-33 ws.onmessage = function(event) a/LayoutTests/http/tests/websocket/tests/hybi/fragmented-frames.html_sec3
28
    var message = event.data;
27
    var message = event.data;
29
    debug("onmessage() was called. (message = \"" + message + "\")");
28
    debug("onmessage() was called. (message = \"" + message + "\")");
30
    actualMessages.push(message);
29
    actualMessages.push(message);
30
31
    if (actualMessages.length == 3)
32
        ws.close();
31
};
33
};
32
34
33
ws.onclose = function(event)
35
ws.onclose = function(event)
- a/LayoutTests/http/tests/websocket/tests/hybi/unmasked-frames.html -2 / +1 lines
Lines 1-7 a/LayoutTests/http/tests/websocket/tests/hybi/unmasked-frames.html_sec1
1
<!DOCTYPE HTML>
1
<!DOCTYPE HTML>
2
<html>
2
<html>
3
<head>
3
<head>
4
<script src="../../../../js-test-resources/js-test-pre.js"></script>
4
<script src="/js-test-resources/js-test-pre.js"></script>
5
</head>
5
</head>
6
<body>
6
<body>
7
<div id="description"></div>
7
<div id="description"></div>
Lines 20-26 var actualMessages = []; a/LayoutTests/http/tests/websocket/tests/hybi/unmasked-frames.html_sec2
20
ws.onopen = function()
20
ws.onopen = function()
21
{
21
{
22
    debug("onopen() was called.");
22
    debug("onopen() was called.");
23
    ws.close();
24
};
23
};
25
24
26
ws.onmessage = function(event)
25
ws.onmessage = function(event)

Return to Bug 85934