Index: webkit/plugins/ppapi/ppb_websocket_impl.cc |
diff --git a/webkit/plugins/ppapi/ppb_websocket_impl.cc b/webkit/plugins/ppapi/ppb_websocket_impl.cc |
index f8fb1900f8feca7b8e4882e6596addef99ca12cc..95b61df5aa5cd76b84a7af65d08190241b80f5bf 100644 |
--- a/webkit/plugins/ppapi/ppb_websocket_impl.cc |
+++ b/webkit/plugins/ppapi/ppb_websocket_impl.cc |
@@ -234,6 +234,7 @@ int32_t PPB_WebSocket_Impl::Close(uint16_t code, |
// Install |callback|. |
close_callback_ = callback; |
+ // Abort ongoing connect. |
if (state_ == PP_WEBSOCKETREADYSTATE_CONNECTING_DEV) { |
state_ = PP_WEBSOCKETREADYSTATE_CLOSING_DEV; |
PP_RunAndClearCompletionCallback(&connect_callback_, PP_ERROR_ABORTED); |
@@ -242,6 +243,13 @@ int32_t PPB_WebSocket_Impl::Close(uint16_t code, |
return PP_OK_COMPLETIONPENDING; |
} |
+ // Abort ongoing receive. |
+ if (wait_for_receive_) { |
+ wait_for_receive_ = false; |
+ receive_callback_var_ = NULL; |
+ PP_RunAndClearCompletionCallback(&receive_callback_, PP_ERROR_ABORTED); |
+ } |
+ |
// Close connection. |
state_ = PP_WEBSOCKETREADYSTATE_CLOSING_DEV; |
WebString web_reason = WebString::fromUTF8(reason_string->value()); |
@@ -414,6 +422,7 @@ void PPB_WebSocket_Impl::didReceiveMessageError() { |
// But, if no messages are queued and ReceiveMessage() is now on going. |
// We must invoke the callback with error code here. |
wait_for_receive_ = false; |
+ receive_callback_var_ = NULL; |
PP_RunAndClearCompletionCallback(&receive_callback_, PP_ERROR_FAILED); |
} |