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 1173513002: Fix Blink commit type for subframes after initial about:blank load. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Try removing Nasko's original fix 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
Index: Source/core/loader/FrameLoader.cpp
diff --git a/Source/core/loader/FrameLoader.cpp b/Source/core/loader/FrameLoader.cpp
index e63eca19569d0a418ff100f0d677b7740187d16d..2d62c050ac3cdf02aa843c43665e6fe284d36bf4 100644
--- a/Source/core/loader/FrameLoader.cpp
+++ b/Source/core/loader/FrameLoader.cpp
@@ -664,7 +664,13 @@ FrameLoadType FrameLoader::determineFrameLoadType(const FrameLoadRequest& reques
return FrameLoadTypeReload;
if (request.resourceRequest().cachePolicy() == ReloadBypassingCache)
return FrameLoadTypeReloadFromOrigin;
- if (request.lockBackForwardList())
+ // From the HTML5 spec for location.assign():
+ // "If the browsing context's session history contains only one Document,
+ // and that was the about:blank Document created when the browsing context
+ // was created, then the navigation must be done with replacement enabled."
+ if (request.lockBackForwardList()
+ || (!m_stateMachine.committedMultipleRealLoads()
+ && equalIgnoringCase(m_frame->document()->url(), blankURL())))
return FrameLoadTypeRedirectWithLockedBackForwardList;
if (!request.originDocument() && request.resourceRequest().url() == m_documentLoader->urlForHistory())
return FrameLoadTypeSame;
@@ -1211,17 +1217,9 @@ void FrameLoader::startLoad(FrameLoadRequest& frameLoadRequest, FrameLoadType ty
frameLoadRequest.resourceRequest().setFrameType(m_frame->isMainFrame() ? WebURLRequest::FrameTypeTopLevel : WebURLRequest::FrameTypeNested);
ResourceRequest& request = frameLoadRequest.resourceRequest();
- // The current load should replace the history item if it is the first real
Charlie Reis 2015/06/11 16:43:48 This was Nasko's original fix from https://coderev
- // load of the frame.
- bool replacesCurrentHistoryItem = false;
- if (type == FrameLoadTypeRedirectWithLockedBackForwardList
- || !m_stateMachine.committedFirstRealDocumentLoad()) {
- replacesCurrentHistoryItem = true;
- }
-
m_policyDocumentLoader = client()->createDocumentLoader(m_frame, request, frameLoadRequest.substituteData().isValid() ? frameLoadRequest.substituteData() : defaultSubstituteDataForURL(request.url()));
m_policyDocumentLoader->setNavigationType(navigationType);
- m_policyDocumentLoader->setReplacesCurrentHistoryItem(replacesCurrentHistoryItem);
+ m_policyDocumentLoader->setReplacesCurrentHistoryItem(type == FrameLoadTypeRedirectWithLockedBackForwardList);
m_policyDocumentLoader->setIsClientRedirect(frameLoadRequest.clientRedirect() == ClientRedirect);
// stopAllLoaders can detach the LocalFrame, so protect it.

Powered by Google App Engine
This is Rietveld 408576698