Chromium Code Reviews| Index: Source/modules/websockets/WebSocketChannel.cpp |
| diff --git a/Source/modules/websockets/WebSocketChannel.cpp b/Source/modules/websockets/WebSocketChannel.cpp |
| index 344c8b485df322a040890b43553efd2fcdedcba4..776cee48c23aca4104cbb8d963074b723056e2a5 100644 |
| --- a/Source/modules/websockets/WebSocketChannel.cpp |
| +++ b/Source/modules/websockets/WebSocketChannel.cpp |
| @@ -75,6 +75,7 @@ WebSocketChannel::WebSocketChannel(Document* document, WebSocketChannelClient* c |
| , m_resumeTimer(this, &WebSocketChannel::resumeTimerFired) |
| , m_suspended(false) |
| , m_closing(false) |
| + , m_failed(false) |
| , m_receivedClosingHandshake(false) |
| , m_closingTimer(this, &WebSocketChannel::closingTimerFired) |
| , m_closed(false) |
| @@ -207,7 +208,10 @@ void WebSocketChannel::fail(const String& reason) |
| m_deflateFramer.didFail(); |
| m_hasContinuousFrame = false; |
| m_continuousFrameData.clear(); |
| - m_client->didReceiveMessageError(); |
| + if (!m_failed) { |
| + m_failed = true; |
|
tyoshino (SeeGerritForStatus)
2013/04/17 13:50:10
Let's check m_client here. I know that it's curren
|
| + m_client->didReceiveMessageError(); |
| + } |
| if (m_handle && !m_closed) |
| m_handle->disconnect(); // Will call didClose(). |
|
tyoshino (SeeGerritForStatus)
2013/04/17 13:50:10
Could you please s/didClose/didCloseSocketStream/
Li Yin
2013/04/18 02:50:05
didClose will been invoked already after m_handle-
tyoshino (SeeGerritForStatus)
2013/04/18 03:28:16
Yes. But it's named didCloseSocketStream. Not didC
Li Yin
2013/04/18 07:03:03
Okay, thanks for your clarification. I will change
tyoshino (SeeGerritForStatus)
2013/04/18 08:29:59
Yes. Thanks
|
| @@ -322,20 +326,27 @@ void WebSocketChannel::didUpdateBufferedAmount(SocketStreamHandle*, size_t buffe |
| void WebSocketChannel::didFailSocketStream(SocketStreamHandle* handle, const SocketStreamError& error) |
| { |
| LOG(Network, "WebSocketChannel %p didFailSocketStream()", this); |
| - ASSERT(handle == m_handle || !m_handle); |
| - if (m_document) { |
| - String message; |
| - if (error.isNull()) |
| - message = "WebSocket network error"; |
| - else if (error.localizedDescription().isNull()) |
| - message = "WebSocket network error: error code " + String::number(error.errorCode()); |
| - else |
| - message = "WebSocket network error: " + error.localizedDescription(); |
| - InspectorInstrumentation::didReceiveWebSocketFrameError(m_document, m_identifier, message); |
|
tyoshino (SeeGerritForStatus)
2013/04/17 13:50:10
removed as intended?
|
| - m_document->addConsoleMessage(NetworkMessageSource, ErrorMessageLevel, message); |
|
tyoshino (SeeGerritForStatus)
2013/04/17 13:50:10
ditto
Li Yin
2013/04/18 02:50:05
Currently, the onerror event is still called very
tyoshino (SeeGerritForStatus)
2013/04/18 03:28:16
OK. Please keep them removed. Let's postpone fixin
|
| - } |
| + ASSERT_UNUSED(handle, handle == m_handle || !m_handle); |
| m_shouldDiscardReceivedData = true; |
| - handle->disconnect(); |
| + String message; |
| + if (error.isNull()) |
| + message = "WebSocket network error"; |
| + else if (error.localizedDescription().isNull()) |
| + message = "WebSocket network error: error code " + String::number(error.errorCode()); |
| + else |
| + message = "WebSocket network error: error code " + String::number(error.errorCode()) + ", " + error.localizedDescription(); |
| + String failingURL = error.failingURL(); |
| + ASSERT(failingURL.isNull() || m_handshake->url().string() == failingURL); |
| + if (failingURL.isNull()) |
| + failingURL = m_handshake->url().string(); |
| + LOG(Network, "Error Message: %s, FailURL: %s", message.utf8().data(), failingURL.utf8().data()); |
|
tyoshino (SeeGerritForStatus)
2013/04/17 13:50:10
Please
- add "WebSocketChannel %p" boilerplate
- q
|
| + RefPtr<WebSocketChannel> protect(this); |
| + if (m_client && !m_closing && !m_failed) { |
|
tyoshino (SeeGerritForStatus)
2013/04/17 13:50:10
Sorry if i'm misunderstanding, but !m_closing is n
Li Yin
2013/04/18 07:03:03
It is not necessary any more, because the issue is
|
| + m_failed = true; |
| + m_client->didReceiveMessageError(); |
| + } |
| + if (m_handle && !m_closed) |
| + m_handle->disconnect(); |
| } |
| void WebSocketChannel::didReceiveAuthenticationChallenge(SocketStreamHandle*, const AuthenticationChallenge&) |