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

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

Issue 2584513003: PlzNavigate: identify same-page browser-initiated navigation. (Closed)
Patch Set: Very minor fix. 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 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after
1167 ? determineFrameLoadType(request) 1167 ? determineFrameLoadType(request)
1168 : frameLoadType; 1168 : frameLoadType;
1169 bool sameDocumentHistoryNavigation = 1169 bool sameDocumentHistoryNavigation =
1170 isBackForwardLoadType(newLoadType) && 1170 isBackForwardLoadType(newLoadType) &&
1171 historyLoadType == HistorySameDocumentLoad; 1171 historyLoadType == HistorySameDocumentLoad;
1172 bool sameDocumentNavigation = 1172 bool sameDocumentNavigation =
1173 policy == NavigationPolicyCurrentTab && 1173 policy == NavigationPolicyCurrentTab &&
1174 shouldPerformFragmentNavigation(request.form(), 1174 shouldPerformFragmentNavigation(request.form(),
1175 request.resourceRequest().httpMethod(), 1175 request.resourceRequest().httpMethod(),
1176 newLoadType, url); 1176 newLoadType, url);
1177
1178 // Perform same document navigation. 1177 // Perform same document navigation.
1179 if (sameDocumentHistoryNavigation || sameDocumentNavigation) { 1178 if (sameDocumentHistoryNavigation || sameDocumentNavigation) {
1180 DCHECK(historyItem || !sameDocumentHistoryNavigation); 1179 DCHECK(historyItem || !sameDocumentHistoryNavigation);
1181 RefPtr<SerializedScriptValue> stateObject = 1180 RefPtr<SerializedScriptValue> stateObject =
1182 sameDocumentHistoryNavigation ? historyItem->stateObject() : nullptr; 1181 sameDocumentHistoryNavigation ? historyItem->stateObject() : nullptr;
1183 1182
1184 if (!sameDocumentHistoryNavigation) { 1183 if (!sameDocumentHistoryNavigation) {
1185 m_documentLoader->setNavigationType(determineNavigationType( 1184 m_documentLoader->setNavigationType(determineNavigationType(
1186 newLoadType, false, request.triggeringEvent())); 1185 newLoadType, false, request.triggeringEvent()));
1187 if (shouldTreatURLAsSameAsCurrent(url)) 1186 if (shouldTreatURLAsSameAsCurrent(url))
1188 newLoadType = FrameLoadTypeReplaceCurrentItem; 1187 newLoadType = FrameLoadTypeReplaceCurrentItem;
1189 } 1188 }
1190 1189
1191 loadInSameDocument(url, stateObject, newLoadType, historyLoadType, 1190 loadInSameDocument(url, stateObject, newLoadType, historyLoadType,
1192 request.clientRedirect(), request.originDocument()); 1191 request.clientRedirect(), request.originDocument());
1193 return; 1192 return;
1194 } 1193 }
1195 1194
1195 // PlzNavigate
1196 // If the loader classifies this navigation as a different document navigation
1197 // while the browser intended the navigation to be same-document, it means
1198 // that a different navigation must have committed while the IPC was sent.
1199 // This navigation is no more same-document. The navigation is simply dropped.
1200 if (request.resourceRequest().isSameDocumentNavigation())
1201 return;
1202
1196 startLoad(request, newLoadType, policy); 1203 startLoad(request, newLoadType, policy);
1197 } 1204 }
1198 1205
1199 SubstituteData FrameLoader::defaultSubstituteDataForURL(const KURL& url) { 1206 SubstituteData FrameLoader::defaultSubstituteDataForURL(const KURL& url) {
1200 if (!shouldTreatURLAsSrcdocDocument(url)) 1207 if (!shouldTreatURLAsSrcdocDocument(url))
1201 return SubstituteData(); 1208 return SubstituteData();
1202 String srcdoc = m_frame->deprecatedLocalOwner()->fastGetAttribute(srcdocAttr); 1209 String srcdoc = m_frame->deprecatedLocalOwner()->fastGetAttribute(srcdocAttr);
1203 DCHECK(!srcdoc.isNull()); 1210 DCHECK(!srcdoc.isNull());
1204 CString encodedSrcdoc = srcdoc.utf8(); 1211 CString encodedSrcdoc = srcdoc.utf8();
1205 return SubstituteData( 1212 return SubstituteData(
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after
1906 m_documentLoader ? m_documentLoader->url() : String()); 1913 m_documentLoader ? m_documentLoader->url() : String());
1907 return tracedValue; 1914 return tracedValue;
1908 } 1915 }
1909 1916
1910 inline void FrameLoader::takeObjectSnapshot() const { 1917 inline void FrameLoader::takeObjectSnapshot() const {
1911 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, 1918 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this,
1912 toTracedValue()); 1919 toTracedValue());
1913 } 1920 }
1914 1921
1915 } // namespace blink 1922 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698