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

Unified Diff: Source/core/loader/FrameLoader.cpp

Issue 410223003: location.reload() after POST should re-POST (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add comment about ClientRedirectPolicy in FrameLoader::reload() Created 6 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
« no previous file with comments | « Source/core/loader/FrameLoader.h ('k') | Source/core/loader/NavigationScheduler.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/loader/FrameLoader.cpp
diff --git a/Source/core/loader/FrameLoader.cpp b/Source/core/loader/FrameLoader.cpp
index c973368e0dddfd1e43d707f42fc200e97b2b2c9f..dc8c56e0ed192e4c9933178cf0656e5e4aed3a04 100644
--- a/Source/core/loader/FrameLoader.cpp
+++ b/Source/core/loader/FrameLoader.cpp
@@ -817,7 +817,7 @@ ResourceRequest FrameLoader::requestFromHistoryItem(HistoryItem* item, ResourceR
return request;
}
-void FrameLoader::reload(ReloadPolicy reloadPolicy, const KURL& overrideURL, const AtomicString& overrideEncoding)
+void FrameLoader::reload(ReloadPolicy reloadPolicy, const KURL& overrideURL, const AtomicString& overrideEncoding, ClientRedirectPolicy clientRedirectPolicy)
{
if (!m_currentItem)
return;
@@ -826,13 +826,23 @@ void FrameLoader::reload(ReloadPolicy reloadPolicy, const KURL& overrideURL, con
ResourceRequest request = requestFromHistoryItem(m_currentItem.get(), cachePolicy);
request.setFrameType(m_frame->isMainFrame() ? WebURLRequest::FrameTypeTopLevel : WebURLRequest::FrameTypeNested);
request.setRequestContext(WebURLRequest::RequestContextInternal);
+
+ // ClientRedirectPolicy is an indication that this load was triggered by
+ // some direct interaction with the page. If this reload is not a client
+ // redirect, we should reuse the referrer from the original load of the
+ // current document. If this reload is a client redirect (e.g., location.reload()),
+ // it was initiated by something in the current document and should
+ // therefore show the current document's url as the referrer.
+ if (clientRedirectPolicy == ClientRedirect)
+ request.setHTTPReferrer(Referrer(m_frame->document()->outgoingReferrer(), m_frame->document()->referrerPolicy()));
+
if (!overrideURL.isEmpty()) {
request.setURL(overrideURL);
request.clearHTTPReferrer();
}
FrameLoadType type = reloadPolicy == EndToEndReload ? FrameLoadTypeReloadFromOrigin : FrameLoadTypeReload;
- loadWithNavigationAction(NavigationAction(request, type), type, nullptr, SubstituteData(), CheckContentSecurityPolicy, NotClientRedirect, overrideEncoding);
+ loadWithNavigationAction(NavigationAction(request, type), type, nullptr, SubstituteData(), CheckContentSecurityPolicy, clientRedirectPolicy, overrideEncoding);
}
void FrameLoader::stopAllLoaders()
« no previous file with comments | « Source/core/loader/FrameLoader.h ('k') | Source/core/loader/NavigationScheduler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698