Title: [117944] trunk
- Revision
- 117944
- Author
- [email protected]
- Date
- 2012-05-22 03:52:12 -0700 (Tue, 22 May 2012)
Log Message
[WebSocket] WebSocket object should fire a simple event named error when it is required to fail the websocket connection.
https://bugs.webkit.org/show_bug.cgi?id=86958
Source/WebCore:
Patch by Li Yin <[email protected]> on 2012-05-22
Reviewed by Kent Tamura.
Spec:http://dev.w3.org/html5/websockets/#feedback-from-the-protocol
If the user agent was required to fail the websocket connection or the
WebSocket connection is closed with prejudice, fire a simple event
named error at the WebSocket object.
Tests: http/tests/websocket/tests/hybi/close.html
* Modules/websockets/WebSocket.cpp:
(WebCore::WebSocket::didReceiveMessageError):
* Modules/websockets/WebSocketChannel.cpp:
(WebCore::WebSocketChannel::fail):
LayoutTests:
Spec:http://dev.w3.org/html5/websockets/#feedback-from-the-protocol
If the user agent was required to fail the websocket connection or the
WebSocket connection is closed with prejudice, fire a simple event
named error at the WebSocket object.
Patch by Li Yin <[email protected]> on 2012-05-22
Reviewed by Kent Tamura.
* http/tests/websocket/tests/hybi/close-expected.txt:
* http/tests/websocket/tests/hybi/close.html:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (117943 => 117944)
--- trunk/LayoutTests/ChangeLog 2012-05-22 10:49:20 UTC (rev 117943)
+++ trunk/LayoutTests/ChangeLog 2012-05-22 10:52:12 UTC (rev 117944)
@@ -1,3 +1,18 @@
+2012-05-22 Li Yin <[email protected]>
+
+ [WebSocket] WebSocket object should fire a simple event named error when it is required to fail the websocket connection.
+ https://bugs.webkit.org/show_bug.cgi?id=86958
+
+ Spec:http://dev.w3.org/html5/websockets/#feedback-from-the-protocol
+ If the user agent was required to fail the websocket connection or the
+ WebSocket connection is closed with prejudice, fire a simple event
+ named error at the WebSocket object.
+
+ Reviewed by Kent Tamura.
+
+ * http/tests/websocket/tests/hybi/close-expected.txt:
+ * http/tests/websocket/tests/hybi/close.html:
+
2012-05-22 Kent Tamura <[email protected]>
[Chromium] Remove an entry for css3/filters/custom/filter-repaint-custom-rotated.html
Modified: trunk/LayoutTests/http/tests/websocket/tests/hybi/close-expected.txt (117943 => 117944)
--- trunk/LayoutTests/http/tests/websocket/tests/hybi/close-expected.txt 2012-05-22 10:49:20 UTC (rev 117943)
+++ trunk/LayoutTests/http/tests/websocket/tests/hybi/close-expected.txt 2012-05-22 10:52:12 UTC (rev 117944)
@@ -58,6 +58,7 @@
Code NaN must cause INVALID_ACCESS_ERR.
PASS exceptionProto === DOMException.prototype is true
PASS exceptionName is invalidAccessErr
+PASS onerror was called.
runCodeTest: onclose().
PASS closeEvent.code is abnormalClosure
Skip invalid string test.
@@ -74,6 +75,7 @@
PASS exceptionProto === DOMException.prototype is true
PASS exceptionName is syntaxErr
Reason test: 2
+PASS onerror was called.
runReasonTest: onclose().
PASS closeEvent.code is abnormalClosure
Code and reason test: 0
Modified: trunk/LayoutTests/http/tests/websocket/tests/hybi/close.html (117943 => 117944)
--- trunk/LayoutTests/http/tests/websocket/tests/hybi/close.html 2012-05-22 10:49:20 UTC (rev 117943)
+++ trunk/LayoutTests/http/tests/websocket/tests/hybi/close.html 2012-05-22 10:52:12 UTC (rev 117944)
@@ -89,6 +89,10 @@
if (closeEvent.code == abnormalClosure)
runInvalidStringTest();
};
+ ws._onerror_ = function()
+ {
+ testPassed("onerror was called.");
+ };
}
try {
ws.close(codeTestCodes[id]);
@@ -127,6 +131,10 @@
if (closeEvent.code == abnormalClosure)
runCodeAndReasonTest();
};
+ ws._onerror_ = function()
+ {
+ testPassed("onerror was called.");
+ }
}
try {
ws.close(normalClosure, reasonTestReasons[id]);
Modified: trunk/Source/WebCore/ChangeLog (117943 => 117944)
--- trunk/Source/WebCore/ChangeLog 2012-05-22 10:49:20 UTC (rev 117943)
+++ trunk/Source/WebCore/ChangeLog 2012-05-22 10:52:12 UTC (rev 117944)
@@ -1,3 +1,22 @@
+2012-05-22 Li Yin <[email protected]>
+
+ [WebSocket] WebSocket object should fire a simple event named error when it is required to fail the websocket connection.
+ https://bugs.webkit.org/show_bug.cgi?id=86958
+
+ Reviewed by Kent Tamura.
+
+ Spec:http://dev.w3.org/html5/websockets/#feedback-from-the-protocol
+ If the user agent was required to fail the websocket connection or the
+ WebSocket connection is closed with prejudice, fire a simple event
+ named error at the WebSocket object.
+
+ Tests: http/tests/websocket/tests/hybi/close.html
+
+ * Modules/websockets/WebSocket.cpp:
+ (WebCore::WebSocket::didReceiveMessageError):
+ * Modules/websockets/WebSocketChannel.cpp:
+ (WebCore::WebSocketChannel::fail):
+
2012-05-22 Yury Semikhatsky <[email protected]>
Web Inspector: allow showing selected object in another heap profiler view
Modified: trunk/Source/WebCore/Modules/websockets/WebSocket.cpp (117943 => 117944)
--- trunk/Source/WebCore/Modules/websockets/WebSocket.cpp 2012-05-22 10:49:20 UTC (rev 117943)
+++ trunk/Source/WebCore/Modules/websockets/WebSocket.cpp 2012-05-22 10:52:12 UTC (rev 117944)
@@ -531,7 +531,7 @@
void WebSocket::didReceiveMessageError()
{
LOG(Network, "WebSocket %p didReceiveErrorMessage", this);
- if (m_state != OPEN && m_state != CLOSING)
+ if (m_useHixie76Protocol && m_state != OPEN && m_state != CLOSING)
return;
ASSERT(scriptExecutionContext());
dispatchEvent(Event::create(eventNames().errorEvent, false, false));
Modified: trunk/Source/WebCore/Modules/websockets/WebSocketChannel.cpp (117943 => 117944)
--- trunk/Source/WebCore/Modules/websockets/WebSocketChannel.cpp 2012-05-22 10:49:20 UTC (rev 117943)
+++ trunk/Source/WebCore/Modules/websockets/WebSocketChannel.cpp 2012-05-22 10:52:12 UTC (rev 117944)
@@ -220,12 +220,14 @@
// Hybi-10 specification explicitly states we must not continue to handle incoming data
// once the WebSocket connection is failed (section 7.1.7).
// FIXME: Should we do this in hixie-76 too?
+ RefPtr<WebSocketChannel> protect(this); // The client can close the channel, potentially removing the last reference.
m_shouldDiscardReceivedData = true;
if (m_buffer)
skipBuffer(m_bufferSize); // Save memory.
m_deflateFramer.didFail();
m_hasContinuousFrame = false;
m_continuousFrameData.clear();
+ m_client->didReceiveMessageError();
}
if (m_handle && !m_closed)
m_handle->disconnect(); // Will call didClose().
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes