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

Side by Side Diff: chrome/browser/net/net_error_tab_helper.cc

Issue 1276843006: Don't run platform diagnostics tool on invalid URLs from the renderer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 | chrome/browser/net/net_error_tab_helper_unittest.cc » ('j') | 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/net/net_error_tab_helper.h" 5 #include "chrome/browser/net/net_error_tab_helper.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 rfh->Send(new ChromeViewMsg_NetErrorInfo(rfh->GetRoutingID(), 255 rfh->Send(new ChromeViewMsg_NetErrorInfo(rfh->GetRoutingID(),
256 dns_probe_status_)); 256 dns_probe_status_));
257 257
258 if (!dns_probe_status_snoop_callback_.is_null()) 258 if (!dns_probe_status_snoop_callback_.is_null())
259 dns_probe_status_snoop_callback_.Run(dns_probe_status_); 259 dns_probe_status_snoop_callback_.Run(dns_probe_status_);
260 } 260 }
261 261
262 void NetErrorTabHelper::RunNetworkDiagnostics(const GURL& url) { 262 void NetErrorTabHelper::RunNetworkDiagnostics(const GURL& url) {
263 // Only run diagnostics on HTTP or HTTPS URLs. Shouldn't receive URLs with 263 // Only run diagnostics on HTTP or HTTPS URLs. Shouldn't receive URLs with
264 // any other schemes, but the renderer is not trusted. 264 // any other schemes, but the renderer is not trusted.
265 if (!url.SchemeIsHTTPOrHTTPS()) 265 if (!url.is_valid() || !url.SchemeIsHTTPOrHTTPS())
266 return; 266 return;
267 // Sanitize URL prior to running diagnostics on it. 267 // Sanitize URL prior to running diagnostics on it.
268 RunNetworkDiagnosticsHelper(url.GetOrigin()); 268 RunNetworkDiagnosticsHelper(url.GetOrigin());
269 } 269 }
270 270
271 void NetErrorTabHelper::RunNetworkDiagnosticsHelper( 271 void NetErrorTabHelper::RunNetworkDiagnosticsHelper(
272 const GURL& sanitized_url) { 272 const GURL& sanitized_url) {
273 ShowNetworkDiagnosticsDialog(web_contents(), sanitized_url); 273 ShowNetworkDiagnosticsDialog(web_contents(), sanitized_url);
274 } 274 }
275 275
276 } // namespace chrome_browser_net 276 } // namespace chrome_browser_net
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/net/net_error_tab_helper_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698