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

Unified Diff: content/browser/browser_url_handler_impl.cc

Issue 655023002: Fix view-source url creation logic (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/browser_url_handler_impl.cc
diff --git a/content/browser/browser_url_handler_impl.cc b/content/browser/browser_url_handler_impl.cc
index 71e35998f52dea3567d9b63612c0e7435149b1f2..7ea7ff787b9950512615abcde874d22daa6ebe6c 100644
--- a/content/browser/browser_url_handler_impl.cc
+++ b/content/browser/browser_url_handler_impl.cc
@@ -62,12 +62,8 @@ static bool ReverseViewSource(GURL* url, BrowserContext* browser_context) {
// No action necessary if the URL is already view-source:
if (url->SchemeIs(kViewSourceScheme))
return false;
-
- url::Replacements<char> repl;
- repl.SetScheme(kViewSourceScheme,
- url::Component(0, strlen(kViewSourceScheme)));
- repl.SetPath(url->spec().c_str(), url::Component(0, url->spec().size()));
- *url = url->ReplaceComponents(repl);
+ // Recreate the url with the view-source scheme.
+ *url = GURL(kViewSourceScheme + std::string(":") + url->spec());
sky 2014/10/14 19:56:31 Doesn't gurl have the ability to replace parts of
sgurun-gerrit only 2014/10/14 21:02:52 I could not see an easy way of doing it. Two possi
joth 2014/10/17 20:18:39 Thanks for fixing my bug! (well, bug my cl exposed
sgurun-gerrit only 2014/10/17 20:35:35 Rather then regression tests, I have written a uni
sgurun-gerrit only 2014/10/17 20:37:39 haha I think I read regression as integration test
return true;
}
« 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