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

Side by Side Diff: chrome/browser/extensions/api/identity/web_auth_flow.cc

Issue 2366953002: Fix WebAuthFlow crash of dereferencing nullptr navigation_handle->GetResponseHeaders(). (Closed)
Patch Set: Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/api/identity/web_auth_flow.h" 5 #include "chrome/browser/extensions/api/identity/web_auth_flow.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 void WebAuthFlow::DidFinishNavigation( 205 void WebAuthFlow::DidFinishNavigation(
206 content::NavigationHandle* navigation_handle) { 206 content::NavigationHandle* navigation_handle) {
207 bool failed = false; 207 bool failed = false;
208 208
209 if (navigation_handle->GetNetErrorCode() != net::OK) { 209 if (navigation_handle->GetNetErrorCode() != net::OK) {
210 failed = true; 210 failed = true;
211 TRACE_EVENT_ASYNC_STEP_PAST1("identity", "WebAuthFlow", this, 211 TRACE_EVENT_ASYNC_STEP_PAST1("identity", "WebAuthFlow", this,
212 "DidFinishNavigationFailure", "error_code", 212 "DidFinishNavigationFailure", "error_code",
213 navigation_handle->GetNetErrorCode()); 213 navigation_handle->GetNetErrorCode());
214 } else if (navigation_handle->IsInMainFrame() && 214 } else if (navigation_handle->IsInMainFrame() &&
215 navigation_handle->GetResponseHeaders() &&
215 navigation_handle->GetResponseHeaders()->response_code() >= 400) { 216 navigation_handle->GetResponseHeaders()->response_code() >= 400) {
216 failed = true; 217 failed = true;
217 TRACE_EVENT_ASYNC_STEP_PAST1( 218 TRACE_EVENT_ASYNC_STEP_PAST1(
218 "identity", "WebAuthFlow", this, "DidFinishNavigationFailure", 219 "identity", "WebAuthFlow", this, "DidFinishNavigationFailure",
219 "response_code", 220 "response_code",
220 navigation_handle->GetResponseHeaders()->response_code()); 221 navigation_handle->GetResponseHeaders()->response_code());
221 } 222 }
222 223
223 if (failed && delegate_) 224 if (failed && delegate_)
224 delegate_->OnAuthFlowFailure(LOAD_FAILED); 225 delegate_->OnAuthFlowFailure(LOAD_FAILED);
225 } 226 }
226 227
227 } // namespace extensions 228 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698