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, ¶ms->extra_headers); |
} |