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

Unified Diff: components/url_formatter/url_fixer.cc

Issue 2378213002: Mark URLs with empty schemes as invalid. (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 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 53abe4e0c4a910aa2a065160af3f35c0533352be..cf60f43d3b57874a0ebe1c5ccda1e2817ea3e961 100644
--- a/components/url_formatter/url_fixer.cc
+++ b/components/url_formatter/url_fixer.cc
@@ -480,7 +480,8 @@ std::string SegmentURLInternal(std::string* text, url::Parsed* parts) {
// Construct the text to parse by inserting the scheme.
std::string inserted_text(scheme);
- inserted_text.append(url::kStandardSchemeSeparator);
+ if (first_nonwhite == text->end() || *first_nonwhite != ':')
Peter Kasting 2016/09/29 04:54:12 Not sure I really understand this change. Why con
+ inserted_text.append(url::kStandardSchemeSeparator); // Add "://".
std::string text_to_parse(text->begin(), first_nonwhite);
text_to_parse.append(inserted_text);
text_to_parse.append(first_nonwhite, text->end());

Powered by Google App Engine
This is Rietveld 408576698