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

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

Issue 25269006: Initial iframe loads shouldn't add session history items. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rewriting the fix in a different way and adding a test. Created 7 years, 3 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 | « no previous file | Source/web/tests/WebFrameTest.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 8f4cf0cb52da2c9aec02fcc6388727ebe47261c6..5d5e4ef4899b3da7b20d00b90cd06d0c318d1fb9 100644
--- a/Source/core/loader/FrameLoader.cpp
+++ b/Source/core/loader/FrameLoader.cpp
@@ -1339,10 +1339,19 @@ void FrameLoader::loadWithNavigationAction(const ResourceRequest& request, const
if (!m_stateMachine.startedFirstRealLoad())
m_stateMachine.advanceTo(FrameLoaderStateMachine::StartedFirstRealLoad);
+ // The current load should replace the history item if it is the first real
+ // load of the frame. FrameLoadTypeRedirectWithLockedBackForwardList is a
+ // proxy for history()->currentItemShouldBeReplaced().
+ bool replacesCurrentHistoryItem = false;
+ if (type == FrameLoadTypeRedirectWithLockedBackForwardList
+ || !m_stateMachine.committedFirstRealDocumentLoad()) {
+ replacesCurrentHistoryItem = true;
+ }
+
m_policyDocumentLoader = m_client->createDocumentLoader(request, substituteData.isValid() ? substituteData : defaultSubstituteDataForURL(request.url()));
m_policyDocumentLoader->setFrame(m_frame);
m_policyDocumentLoader->setTriggeringAction(action);
- m_policyDocumentLoader->setReplacesCurrentHistoryItem(type == FrameLoadTypeRedirectWithLockedBackForwardList);
+ m_policyDocumentLoader->setReplacesCurrentHistoryItem(replacesCurrentHistoryItem);
m_policyDocumentLoader->setIsClientRedirect(m_startingClientRedirect);
if (Frame* parent = m_frame->tree()->parent())
« no previous file with comments | « no previous file | Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698