Title: [173642] trunk
Revision
173642
Author
[email protected]
Date
2014-09-15 17:45:04 -0700 (Mon, 15 Sep 2014)

Log Message

Web Core: Websocket state should be set to closed in didReceiveMessage call back.
https://bugs.webkit.org/show_bug.cgi?id=136219

Patch by Shivakumar JM <[email protected]> on 2014-09-15
Reviewed by Alexey Proskuryakov.

Source/WebCore:

Set the Websocket state to closed in didReceiveMessage call back.

Test: http/tests/websocket/tests/hybi/error-event-ready-state.html

* Modules/websockets/WebSocket.cpp:
(WebCore::WebSocket::didReceiveMessageError):

LayoutTests:

Added test to check readyState is CLOSED within onerror event.

* http/tests/websocket/tests/hybi/error-event-ready-state-expected.txt: Added.
* http/tests/websocket/tests/hybi/error-event-ready-state.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (173641 => 173642)


--- trunk/LayoutTests/ChangeLog	2014-09-16 00:44:16 UTC (rev 173641)
+++ trunk/LayoutTests/ChangeLog	2014-09-16 00:45:04 UTC (rev 173642)
@@ -1,3 +1,15 @@
+2014-09-15  Shivakumar JM  <[email protected]>
+
+        Web Core: Websocket state should be set to closed in didReceiveMessage call back.
+        https://bugs.webkit.org/show_bug.cgi?id=136219
+
+        Reviewed by Alexey Proskuryakov.
+
+        Added test to check readyState is CLOSED within onerror event.
+
+        * http/tests/websocket/tests/hybi/error-event-ready-state-expected.txt: Added.
+        * http/tests/websocket/tests/hybi/error-event-ready-state.html: Added.
+
 2014-09-15  Roger Fong  <[email protected]>
 
         Unreviewed. Windows rebaselining to account for subpixel layout Part 1.

Added: trunk/LayoutTests/http/tests/websocket/tests/hybi/error-event-ready-state-expected.txt (0 => 173642)


--- trunk/LayoutTests/http/tests/websocket/tests/hybi/error-event-ready-state-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/websocket/tests/hybi/error-event-ready-state-expected.txt	2014-09-16 00:45:04 UTC (rev 173642)
@@ -0,0 +1,11 @@
+CONSOLE MESSAGE: WebSocket connection to 'ws://localhost:8880/non-existent-url' failed: Unexpected response code: 404
+Test that readyState is CLOSED within onerror event
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+onerror() was called.
+PASS ws.readyState is 3
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/http/tests/websocket/tests/hybi/error-event-ready-state.html (0 => 173642)


--- trunk/LayoutTests/http/tests/websocket/tests/hybi/error-event-ready-state.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/websocket/tests/hybi/error-event-ready-state.html	2014-09-16 00:45:04 UTC (rev 173642)
@@ -0,0 +1,25 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script type="text/_javascript_">
+description("Test that readyState is CLOSED within onerror event");
+
+window.jsTestIsAsync = true;
+
+var ws = new WebSocket("ws://localhost:8880/non-existent-url");
+
+ws._onerror_ = function(event) {
+    debug("onerror() was called.");
+    shouldBe("ws.readyState", "3");
+    finishJSTest();
+};
+
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (173641 => 173642)


--- trunk/Source/WebCore/ChangeLog	2014-09-16 00:44:16 UTC (rev 173641)
+++ trunk/Source/WebCore/ChangeLog	2014-09-16 00:45:04 UTC (rev 173642)
@@ -1,3 +1,17 @@
+2014-09-15  Shivakumar JM  <[email protected]>
+
+        Web Core: Websocket state should be set to closed in didReceiveMessage call back.
+        https://bugs.webkit.org/show_bug.cgi?id=136219
+
+        Reviewed by Alexey Proskuryakov.
+
+        Set the Websocket state to closed in didReceiveMessage call back.
+
+        Test: http/tests/websocket/tests/hybi/error-event-ready-state.html
+
+        * Modules/websockets/WebSocket.cpp:
+        (WebCore::WebSocket::didReceiveMessageError):
+
 2014-09-15  Jon Honeycutt  <[email protected]>
 
         Naming clean-up.

Modified: trunk/Source/WebCore/Modules/websockets/WebSocket.cpp (173641 => 173642)


--- trunk/Source/WebCore/Modules/websockets/WebSocket.cpp	2014-09-16 00:44:16 UTC (rev 173641)
+++ trunk/Source/WebCore/Modules/websockets/WebSocket.cpp	2014-09-16 00:45:04 UTC (rev 173642)
@@ -533,6 +533,7 @@
 void WebSocket::didReceiveMessageError()
 {
     LOG(Network, "WebSocket %p didReceiveErrorMessage()", this);
+    m_state = CLOSED;
     ASSERT(scriptExecutionContext());
     dispatchEvent(Event::create(eventNames().errorEvent, false, false));
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to