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

Unified Diff: components/url_formatter/url_fixer.cc

Issue 1942613002: Change semicolon replace logic in url_fixer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
Index: components/url_formatter/url_fixer.cc
diff --git a/components/url_formatter/url_fixer.cc b/components/url_formatter/url_fixer.cc
index e227d7855c46d3329dc7bf2840594ed0e5002496..53abe4e0c4a910aa2a065160af3f35c0533352be 100644
--- a/components/url_formatter/url_fixer.cc
+++ b/components/url_formatter/url_fixer.cc
@@ -422,12 +422,18 @@ std::string SegmentURLInternal(std::string* text, url::Parsed* parts) {
std::string scheme;
if (!GetValidScheme(*text, &parts->scheme, &scheme)) {
// Try again if there is a ';' in the text. If changing it to a ':' results
- // in a scheme being found, continue processing with the modified text.
+ // in a standard scheme, "about", "chrome" or "file" scheme being found,
+ // continue processing with the modified text.
bool found_scheme = false;
size_t semicolon = text->find(';');
if (semicolon != 0 && semicolon != std::string::npos) {
(*text)[semicolon] = ':';
- if (GetValidScheme(*text, &parts->scheme, &scheme))
+ if (GetValidScheme(*text, &parts->scheme, &scheme) &&
+ (url::IsStandard(
+ scheme.c_str(),
+ url::Component(0, static_cast<int>(scheme.length()))) ||
+ scheme == url::kAboutScheme || scheme == kChromeUIScheme ||
+ scheme == url::kFileScheme))
found_scheme = true;
else
(*text)[semicolon] = ';';
« no previous file with comments | « components/omnibox/browser/autocomplete_input_unittest.cc ('k') | components/url_formatter/url_fixer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698