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

Unified Diff: chrome/browser/search_engines/template_url_model.cc

Issue 3259010: Don't treat input with a scheme that's not "http" or "https" as a potential k... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/autocomplete/keyword_provider_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/search_engines/template_url_model.cc
===================================================================
--- chrome/browser/search_engines/template_url_model.cc (revision 58197)
+++ chrome/browser/search_engines/template_url_model.cc (working copy)
@@ -131,6 +131,15 @@
if (url_parse::ExtractScheme(WideToUTF8(keyword).c_str(),
static_cast<int>(keyword.length()),
&scheme_component)) {
+ // If the scheme isn't "http" or "https", bail. The user isn't trying to
+ // type a web address, but rather an FTP, file:, or other scheme URL, or a
+ // search query with some sort of initial operator (e.g. "site:").
+ if (result.compare(0, scheme_component.end(),
+ ASCIIToWide(chrome::kHttpScheme)) &&
+ result.compare(0, scheme_component.end(),
+ ASCIIToWide(chrome::kHttpsScheme)))
+ return std::wstring();
+
// Include trailing ':'.
result.erase(0, scheme_component.end() + 1);
// Many schemes usually have "//" after them, so strip it too.
« no previous file with comments | « chrome/browser/autocomplete/keyword_provider_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698