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

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..ca73a53a431c03ef69dd6c2a84147dad439c55b2 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 already been deleted.
+ 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