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

Unified Diff: content/browser/frame_host/navigation_controller_impl.cc

Issue 923183003: Move URL fixup to a preliminary phase that doesn't affect virtual URLs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix leak in test. Created 5 years, 10 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: content/browser/frame_host/navigation_controller_impl.cc
diff --git a/content/browser/frame_host/navigation_controller_impl.cc b/content/browser/frame_host/navigation_controller_impl.cc
index 979b26c1dc5603b12adb1edc1907ea5a08cc41aa..41f299463a7d693bcbeb391e7936688204e46fe2 100644
--- a/content/browser/frame_host/navigation_controller_impl.cc
+++ b/content/browser/frame_host/navigation_controller_impl.cc
@@ -165,11 +165,15 @@ NavigationEntry* NavigationController::CreateNavigationEntry(
bool is_renderer_initiated,
const std::string& extra_headers,
BrowserContext* browser_context) {
+ // Fix up the given URL before letting it be rewritten, so that any minor
+ // cleanup (e.g., removing leading dots) will not lead to a virtual URL.
+ GURL dest_url = GetContentClient()->browser()->FixupURL(url);
msw 2015/02/17 22:51:38 Why can't this just call url_fixer::FixupURL direc
Charlie Reis 2015/02/17 22:57:27 content/ can't depend on components/.
msw 2015/02/17 23:06:41 Acknowledged.
+
// Allow the browser URL handler to rewrite the URL. This will, for example,
// remove "view-source:" from the beginning of the URL to get the URL that
// will actually be loaded. This real URL won't be shown to the user, just
// used internally.
- GURL loaded_url(url);
+ GURL loaded_url(dest_url);
bool reverse_on_redirect = false;
BrowserURLHandlerImpl::GetInstance()->RewriteURLIfNecessary(
&loaded_url, browser_context, &reverse_on_redirect);
@@ -183,8 +187,8 @@ NavigationEntry* NavigationController::CreateNavigationEntry(
base::string16(),
transition,
is_renderer_initiated);
- entry->SetVirtualURL(url);
- entry->set_user_typed_url(url);
+ entry->SetVirtualURL(dest_url);
+ entry->set_user_typed_url(dest_url);
entry->set_update_virtual_url_with_url(reverse_on_redirect);
entry->set_extra_headers(extra_headers);
return entry;

Powered by Google App Engine
This is Rietveld 408576698