Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(842)

Unified Diff: net/websockets/websocket_stream.cc

Issue 2628333003: Cancel URLRequest with an appropriate code when WebSocket handshake succeeds (Closed)
Patch Set: fix Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/base/net_error_list.h ('k') | net/websockets/websocket_stream_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/websockets/websocket_stream.cc
diff --git a/net/websockets/websocket_stream.cc b/net/websockets/websocket_stream.cc
index 5920826eb69cd312a26ed043750e34845bbec70d..6598fea81e7b78a0a5a712404e24f4a381a10bd4 100644
--- a/net/websockets/websocket_stream.cc
+++ b/net/websockets/websocket_stream.cc
@@ -148,9 +148,13 @@ class WebSocketStreamRequestImpl : public WebSocketStreamRequest {
timer_->Stop();
+ std::unique_ptr<URLRequest> url_request = std::move(url_request_);
WebSocketHandshakeStreamBase* handshake_stream = handshake_stream_;
handshake_stream_ = nullptr;
connect_delegate_->OnSuccess(handshake_stream->Upgrade());
+
+ // This is safe even if |this| has been already destructed.
Adam Rice 2017/01/13 11:08:44 Grammar nit: "has already been deleted".
yhirano 2017/01/13 11:15:50 Done.
+ url_request->CancelWithError(ERR_WEBSOCKET_HANDSHAKE_SUCCESS);
}
std::string FailureMessageFromNetError(int net_error) {
« no previous file with comments | « net/base/net_error_list.h ('k') | net/websockets/websocket_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698