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

Unified Diff: content/browser/web_contents/web_contents_impl.cc

Issue 10704048: [RDS] Reloads a page using the original request URL (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Adding unit test & removing public function Created 8 years, 6 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/web_contents/web_contents_impl.cc
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index a8493de9a7bb4724a1e188124e2bdf0bdbbcf229..7e5046cded7907c136bce65266a47915ef7f531a 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -188,6 +188,8 @@ ViewMsg_Navigate_Type::Value GetNavigationType(
return ViewMsg_Navigate_Type::RELOAD;
case NavigationControllerImpl::RELOAD_IGNORING_CACHE:
return ViewMsg_Navigate_Type::RELOAD_IGNORING_CACHE;
+ case NavigationControllerImpl::RELOAD_ORIGINAL_REQUEST_URL:
+ return ViewMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL;
case NavigationControllerImpl::NO_RELOAD:
break; // Fall through to rest of function.
}
@@ -215,7 +217,6 @@ void MakeNavigateParams(const NavigationEntryImpl& entry,
params->pending_history_list_offset = controller.GetIndexOfEntry(&entry);
params->current_history_list_offset = controller.GetLastCommittedEntryIndex();
params->current_history_list_length = controller.GetEntryCount();
- params->url = entry.GetURL();
params->referrer = entry.GetReferrer();
params->transition = entry.GetTransitionType();
params->state = entry.GetContentState();
@@ -233,6 +234,17 @@ void MakeNavigateParams(const NavigationEntryImpl& entry,
params->embedder_channel_name = embedder_channel_name;
params->embedder_container_id = embedder_container_id;
+ if (reload_type == NavigationControllerImpl::RELOAD_ORIGINAL_REQUEST_URL &&
+ entry.GetOriginalRequestURL().is_valid() && !entry.GetHasPostData()) {
+ // We may have been redirected when navigating to the current URL.
+ // Use the URL the user originally intended to visit, if it's valid and if a
+ // POST wasn't involved; the latter case avoids issues with sending data to
+ // the wrong page.
+ params->url = entry.GetOriginalRequestURL();
+ } else {
+ params->url = entry.GetURL();
+ }
+
if (delegate)
delegate->AddNavigationHeaders(params->url, &params->extra_headers);
}

Powered by Google App Engine
This is Rietveld 408576698