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

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

Issue 1175113009: Don't use FrameLoader::m_provisionalItem for history state if a cross-origin (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Give receivedMainResourceRedirect the right url Created 5 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
« no previous file with comments | « Source/core/loader/FrameLoader.h ('k') | no next file » | 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 0bb9bc66894e79f19d623da064e85fb2be17da8a..41a6a23581c20ddd24ad60fa26efac6b2b8250b1 100644
--- a/Source/core/loader/FrameLoader.cpp
+++ b/Source/core/loader/FrameLoader.cpp
@@ -340,10 +340,18 @@ void FrameLoader::replaceDocumentWhileExecutingJavaScriptURL(const String& sourc
documentLoader->replaceDocumentWhileExecutingJavaScriptURL(init, source, ownerDocument);
}
+void FrameLoader::receivedMainResourceRedirect(const KURL& newURL)
+{
+ client()->dispatchDidReceiveServerRedirectForProvisionalLoad();
+ // If a back/forward navigation redirects cross-origin, don't reuse any state from the HistoryItem.
+ if (m_provisionalItem && !SecurityOrigin::create(m_provisionalItem->url())->isSameSchemeHostPort(SecurityOrigin::create(newURL).get()))
+ m_provisionalItem.clear();
+}
+
void FrameLoader::setHistoryItemStateForCommit(HistoryCommitType historyCommitType, HistoryNavigationType navigationType)
{
RefPtrWillBeRawPtr<HistoryItem> oldItem = m_currentItem;
- if (historyCommitType == BackForwardCommit)
+ if (historyCommitType == BackForwardCommit && m_provisionalItem)
m_currentItem = m_provisionalItem.release();
else
m_currentItem = HistoryItem::create();
« no previous file with comments | « Source/core/loader/FrameLoader.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698