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

Side by Side Diff: third_party/WebKit/Source/core/loader/FrameLoader.cpp

Issue 2584513003: PlzNavigate: identify same-page browser-initiated navigation. (Closed)
Patch Set: Adding a DCHECK to probably make a lot of tests fail. Created 3 years, 11 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights
3 * reserved. 3 * reserved.
4 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 4 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
5 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 5 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
6 * (http://www.torchmobile.com/) 6 * (http://www.torchmobile.com/)
7 * Copyright (C) 2008 Alp Toker <alp@atoker.com> 7 * Copyright (C) 2008 Alp Toker <alp@atoker.com>
8 * Copyright (C) Research In Motion Limited 2009. All rights reserved. 8 * Copyright (C) Research In Motion Limited 2009. All rights reserved.
9 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> 9 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com>
10 * Copyright (C) 2011 Google Inc. All rights reserved. 10 * Copyright (C) 2011 Google Inc. All rights reserved.
(...skipping 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after
1166 ? determineFrameLoadType(request) 1166 ? determineFrameLoadType(request)
1167 : frameLoadType; 1167 : frameLoadType;
1168 bool sameDocumentHistoryNavigation = 1168 bool sameDocumentHistoryNavigation =
1169 isBackForwardLoadType(newLoadType) && 1169 isBackForwardLoadType(newLoadType) &&
1170 historyLoadType == HistorySameDocumentLoad; 1170 historyLoadType == HistorySameDocumentLoad;
1171 bool sameDocumentNavigation = 1171 bool sameDocumentNavigation =
1172 policy == NavigationPolicyCurrentTab && 1172 policy == NavigationPolicyCurrentTab &&
1173 shouldPerformFragmentNavigation(request.form(), 1173 shouldPerformFragmentNavigation(request.form(),
1174 request.resourceRequest().httpMethod(), 1174 request.resourceRequest().httpMethod(),
1175 newLoadType, url); 1175 newLoadType, url);
1176
1177 // Perform same document navigation. 1176 // Perform same document navigation.
1178 if (sameDocumentHistoryNavigation || sameDocumentNavigation) { 1177 if (sameDocumentHistoryNavigation || sameDocumentNavigation) {
1179 DCHECK(historyItem || !sameDocumentHistoryNavigation); 1178 DCHECK(historyItem || !sameDocumentHistoryNavigation);
1180 RefPtr<SerializedScriptValue> stateObject = 1179 RefPtr<SerializedScriptValue> stateObject =
1181 sameDocumentHistoryNavigation ? historyItem->stateObject() : nullptr; 1180 sameDocumentHistoryNavigation ? historyItem->stateObject() : nullptr;
1182 1181
1183 if (!sameDocumentHistoryNavigation) { 1182 if (!sameDocumentHistoryNavigation) {
1184 m_documentLoader->setNavigationType(determineNavigationType( 1183 m_documentLoader->setNavigationType(determineNavigationType(
1185 newLoadType, false, request.triggeringEvent())); 1184 newLoadType, false, request.triggeringEvent()));
1186 if (shouldTreatURLAsSameAsCurrent(url)) 1185 if (shouldTreatURLAsSameAsCurrent(url))
1187 newLoadType = FrameLoadTypeReplaceCurrentItem; 1186 newLoadType = FrameLoadTypeReplaceCurrentItem;
1188 } 1187 }
1189 1188
1190 loadInSameDocument(url, stateObject, newLoadType, historyLoadType, 1189 loadInSameDocument(url, stateObject, newLoadType, historyLoadType,
1191 request.clientRedirect(), request.originDocument()); 1190 request.clientRedirect(), request.originDocument());
1192 return; 1191 return;
1193 } 1192 }
1194 1193
1194 // PlzNavigate
1195 // If the loader classifies this navigation as a different document navigation
1196 // while the browser intended the navigation to be same-document, it means
1197 // that a different navigation must have committed while the IPC was sent.
1198 // This navigation is no more same-document. The navigation is simply dropped.
nasko 2017/01/13 19:36:57 Looking at the code in RenderFrameImpl::NavigateIn
arthursonzogni 2017/01/17 15:24:48 It's because the response body stream is empty. Th
nasko 2017/01/19 00:43:35 How about JS executing "window.history.back()" or
arthursonzogni 2017/01/19 17:49:21 For renderer-initiated history-navigation. The ren
1199 if (request.resourceRequest().isSameDocumentNavigation())
1200 return;
1201
1195 startLoad(request, newLoadType, policy); 1202 startLoad(request, newLoadType, policy);
1196 } 1203 }
1197 1204
1198 SubstituteData FrameLoader::defaultSubstituteDataForURL(const KURL& url) { 1205 SubstituteData FrameLoader::defaultSubstituteDataForURL(const KURL& url) {
1199 if (!shouldTreatURLAsSrcdocDocument(url)) 1206 if (!shouldTreatURLAsSrcdocDocument(url))
1200 return SubstituteData(); 1207 return SubstituteData();
1201 String srcdoc = m_frame->deprecatedLocalOwner()->fastGetAttribute(srcdocAttr); 1208 String srcdoc = m_frame->deprecatedLocalOwner()->fastGetAttribute(srcdocAttr);
1202 DCHECK(!srcdoc.isNull()); 1209 DCHECK(!srcdoc.isNull());
1203 CString encodedSrcdoc = srcdoc.utf8(); 1210 CString encodedSrcdoc = srcdoc.utf8();
1204 return SubstituteData( 1211 return SubstituteData(
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after
1905 m_documentLoader ? m_documentLoader->url() : String()); 1912 m_documentLoader ? m_documentLoader->url() : String());
1906 return tracedValue; 1913 return tracedValue;
1907 } 1914 }
1908 1915
1909 inline void FrameLoader::takeObjectSnapshot() const { 1916 inline void FrameLoader::takeObjectSnapshot() const {
1910 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, 1917 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this,
1911 toTracedValue()); 1918 toTracedValue());
1912 } 1919 }
1913 1920
1914 } // namespace blink 1921 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698