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

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

Issue 1189413005: Fix race when reloading original URL (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixing include Created 5 years, 5 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_entry_impl.cc
diff --git a/content/browser/frame_host/navigation_entry_impl.cc b/content/browser/frame_host/navigation_entry_impl.cc
index 5e47912398bed6bf721136e8b2ae7b979241052d..97c4a0efd2a871bdb601e2ee3caccf97f9013126 100644
--- a/content/browser/frame_host/navigation_entry_impl.cc
+++ b/content/browser/frame_host/navigation_entry_impl.cc
@@ -446,10 +446,22 @@ CommonNavigationParams NavigationEntryImpl::ConstructCommonNavigationParams(
ui_timestamp = intent_received_timestamp();
#endif
+ GURL url = frame_entry.url();
+ Referrer referrer = frame_entry.referrer();
+ if (navigation_type == FrameMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL &&
+ GetOriginalRequestURL().is_valid() && !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.
+ url = GetOriginalRequestURL();
+ referrer = Referrer();
+ }
+
return CommonNavigationParams(
- frame_entry.url(), frame_entry.referrer(), GetTransitionType(),
- navigation_type, !IsViewSourceMode(), ui_timestamp, report_type,
- GetBaseURLForDataURL(), GetHistoryURLForDataURL());
+ url, referrer, GetTransitionType(), navigation_type, !IsViewSourceMode(),
+ ui_timestamp, report_type, GetBaseURLForDataURL(),
+ GetHistoryURLForDataURL());
}
StartNavigationParams NavigationEntryImpl::ConstructStartNavigationParams()

Powered by Google App Engine
This is Rietveld 408576698