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

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

Issue 1850123002: Rename WebFrameLoadType::ReloadFromOrigin to ReloadBypassingCache (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 reserv ed. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> 5 * Copyright (C) 2008 Alp Toker <alp@atoker.com>
6 * Copyright (C) Research In Motion Limited 2009. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2009. All rights reserved.
7 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> 7 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com>
8 * Copyright (C) 2011 Google Inc. All rights reserved. 8 * Copyright (C) 2011 Google Inc. All rights reserved.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 using namespace HTMLNames; 104 using namespace HTMLNames;
105 105
106 bool isBackForwardLoadType(FrameLoadType type) 106 bool isBackForwardLoadType(FrameLoadType type)
107 { 107 {
108 return type == FrameLoadTypeBackForward || type == FrameLoadTypeInitialHisto ryLoad; 108 return type == FrameLoadTypeBackForward || type == FrameLoadTypeInitialHisto ryLoad;
109 } 109 }
110 110
111 static bool needsHistoryItemRestore(FrameLoadType type) 111 static bool needsHistoryItemRestore(FrameLoadType type)
112 { 112 {
113 return type == FrameLoadTypeBackForward || type == FrameLoadTypeReload 113 return type == FrameLoadTypeBackForward || type == FrameLoadTypeReload
114 || type == FrameLoadTypeReloadFromOrigin; 114 || type == FrameLoadTypeReloadBypassingCache;
115 } 115 }
116 116
117 // static 117 // static
118 ResourceRequest FrameLoader::resourceRequestFromHistoryItem(HistoryItem* item, 118 ResourceRequest FrameLoader::resourceRequestFromHistoryItem(HistoryItem* item,
119 ResourceRequestCachePolicy cachePolicy) 119 ResourceRequestCachePolicy cachePolicy)
120 { 120 {
121 RefPtr<EncodedFormData> formData = item->formData(); 121 RefPtr<EncodedFormData> formData = item->formData();
122 ResourceRequest request(item->url()); 122 ResourceRequest request(item->url());
123 request.setHTTPReferrer(item->referrer()); 123 request.setHTTPReferrer(item->referrer());
124 request.setCachePolicy(cachePolicy); 124 request.setCachePolicy(cachePolicy);
125 if (formData) { 125 if (formData) {
126 request.setHTTPMethod(HTTPNames::POST); 126 request.setHTTPMethod(HTTPNames::POST);
127 request.setHTTPBody(formData); 127 request.setHTTPBody(formData);
128 request.setHTTPContentType(item->formContentType()); 128 request.setHTTPContentType(item->formContentType());
129 RefPtr<SecurityOrigin> securityOrigin = SecurityOrigin::createFromString (item->referrer().referrer); 129 RefPtr<SecurityOrigin> securityOrigin = SecurityOrigin::createFromString (item->referrer().referrer);
130 request.addHTTPOriginIfNeeded(securityOrigin); 130 request.addHTTPOriginIfNeeded(securityOrigin);
131 } 131 }
132 return request; 132 return request;
133 } 133 }
134 134
135 ResourceRequest FrameLoader::resourceRequestForReload(FrameLoadType frameLoadTyp e, 135 ResourceRequest FrameLoader::resourceRequestForReload(FrameLoadType frameLoadTyp e,
136 const KURL& overrideURL, ClientRedirectPolicy clientRedirectPolicy) 136 const KURL& overrideURL, ClientRedirectPolicy clientRedirectPolicy)
137 { 137 {
138 ASSERT(frameLoadType == FrameLoadTypeReload || frameLoadType == FrameLoadTyp eReloadFromOrigin); 138 ASSERT(frameLoadType == FrameLoadTypeReload || frameLoadType == FrameLoadTyp eReloadBypassingCache);
139 ResourceRequestCachePolicy cachePolicy = frameLoadType == FrameLoadTypeReloa dFromOrigin ? BypassingCache : ValidatingCacheData; 139 ResourceRequestCachePolicy cachePolicy = frameLoadType == FrameLoadTypeReloa dBypassingCache ? BypassingCache : ValidatingCacheData;
140 if (!m_currentItem) 140 if (!m_currentItem)
141 return ResourceRequest(); 141 return ResourceRequest();
142 ResourceRequest request = resourceRequestFromHistoryItem(m_currentItem.get() , cachePolicy); 142 ResourceRequest request = resourceRequestFromHistoryItem(m_currentItem.get() , cachePolicy);
143 143
144 // ClientRedirectPolicy is an indication that this load was triggered by 144 // ClientRedirectPolicy is an indication that this load was triggered by
145 // some direct interaction with the page. If this reload is not a client 145 // some direct interaction with the page. If this reload is not a client
146 // redirect, we should reuse the referrer from the original load of the 146 // redirect, we should reuse the referrer from the original load of the
147 // current document. If this reload is a client redirect (e.g., location.rel oad()), 147 // current document. If this reload is a client redirect (e.g., location.rel oad()),
148 // it was initiated by something in the current document and should 148 // it was initiated by something in the current document and should
149 // therefore show the current document's url as the referrer. 149 // therefore show the current document's url as the referrer.
150 if (clientRedirectPolicy == ClientRedirect) { 150 if (clientRedirectPolicy == ClientRedirect) {
151 request.setHTTPReferrer(Referrer(m_frame->document()->outgoingReferrer() , 151 request.setHTTPReferrer(Referrer(m_frame->document()->outgoingReferrer() ,
152 m_frame->document()->getReferrerPolicy())); 152 m_frame->document()->getReferrerPolicy()));
153 } 153 }
154 154
155 if (!overrideURL.isEmpty()) { 155 if (!overrideURL.isEmpty()) {
156 request.setURL(overrideURL); 156 request.setURL(overrideURL);
157 request.clearHTTPReferrer(); 157 request.clearHTTPReferrer();
158 } 158 }
159 request.setSkipServiceWorker(frameLoadType == FrameLoadTypeReloadFromOrigin) ; 159 request.setSkipServiceWorker(frameLoadType == FrameLoadTypeReloadBypassingCa che);
160 return request; 160 return request;
161 } 161 }
162 162
163 FrameLoader::FrameLoader(LocalFrame* frame) 163 FrameLoader::FrameLoader(LocalFrame* frame)
164 : m_frame(frame) 164 : m_frame(frame)
165 , m_progressTracker(ProgressTracker::create(frame)) 165 , m_progressTracker(ProgressTracker::create(frame))
166 , m_loadType(FrameLoadTypeStandard) 166 , m_loadType(FrameLoadTypeStandard)
167 , m_inStopAllLoaders(false) 167 , m_inStopAllLoaders(false)
168 , m_checkTimer(this, &FrameLoader::checkTimerFired) 168 , m_checkTimer(this, &FrameLoader::checkTimerFired)
169 , m_didAccessInitialDocument(false) 169 , m_didAccessInitialDocument(false)
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 { 769 {
770 if (m_frame->tree().parent() && !m_stateMachine.committedFirstRealDocumentLo ad()) 770 if (m_frame->tree().parent() && !m_stateMachine.committedFirstRealDocumentLo ad())
771 return FrameLoadTypeInitialInChildFrame; 771 return FrameLoadTypeInitialInChildFrame;
772 if (!m_frame->tree().parent() && !client()->backForwardLength()) 772 if (!m_frame->tree().parent() && !client()->backForwardLength())
773 return FrameLoadTypeStandard; 773 return FrameLoadTypeStandard;
774 if (m_provisionalDocumentLoader && request.substituteData().failingURL() == m_provisionalDocumentLoader->url() && m_loadType == FrameLoadTypeBackForward) 774 if (m_provisionalDocumentLoader && request.substituteData().failingURL() == m_provisionalDocumentLoader->url() && m_loadType == FrameLoadTypeBackForward)
775 return FrameLoadTypeBackForward; 775 return FrameLoadTypeBackForward;
776 if (request.resourceRequest().getCachePolicy() == ValidatingCacheData) 776 if (request.resourceRequest().getCachePolicy() == ValidatingCacheData)
777 return FrameLoadTypeReload; 777 return FrameLoadTypeReload;
778 if (request.resourceRequest().getCachePolicy() == BypassingCache) 778 if (request.resourceRequest().getCachePolicy() == BypassingCache)
779 return FrameLoadTypeReloadFromOrigin; 779 return FrameLoadTypeReloadBypassingCache;
780 // From the HTML5 spec for location.assign(): 780 // From the HTML5 spec for location.assign():
781 // "If the browsing context's session history contains only one Document, 781 // "If the browsing context's session history contains only one Document,
782 // and that was the about:blank Document created when the browsing context 782 // and that was the about:blank Document created when the browsing context
783 // was created, then the navigation must be done with replacement enabled. " 783 // was created, then the navigation must be done with replacement enabled. "
784 if (request.replacesCurrentItem() 784 if (request.replacesCurrentItem()
785 || (!m_stateMachine.committedMultipleRealLoads() 785 || (!m_stateMachine.committedMultipleRealLoads()
786 && equalIgnoringCase(m_frame->document()->url(), blankURL()))) 786 && equalIgnoringCase(m_frame->document()->url(), blankURL())))
787 return FrameLoadTypeReplaceCurrentItem; 787 return FrameLoadTypeReplaceCurrentItem;
788 788
789 if (request.resourceRequest().url() == m_documentLoader->urlForHistory()) { 789 if (request.resourceRequest().url() == m_documentLoader->urlForHistory()) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 { 821 {
822 if (!targetFrame && !request.frameName().isEmpty()) 822 if (!targetFrame && !request.frameName().isEmpty())
823 return true; 823 return true;
824 // FIXME: This case is a workaround for the fact that ctrl+clicking a form s ubmission incorrectly 824 // FIXME: This case is a workaround for the fact that ctrl+clicking a form s ubmission incorrectly
825 // sends as a GET rather than a POST if it creates a new window in a differe nt process. 825 // sends as a GET rather than a POST if it creates a new window in a differe nt process.
826 return request.form() && policy != NavigationPolicyCurrentTab; 826 return request.form() && policy != NavigationPolicyCurrentTab;
827 } 827 }
828 828
829 static NavigationType determineNavigationType(FrameLoadType frameLoadType, bool isFormSubmission, bool haveEvent) 829 static NavigationType determineNavigationType(FrameLoadType frameLoadType, bool isFormSubmission, bool haveEvent)
830 { 830 {
831 bool isReload = frameLoadType == FrameLoadTypeReload || frameLoadType == Fra meLoadTypeReloadFromOrigin; 831 bool isReload = frameLoadType == FrameLoadTypeReload || frameLoadType == Fra meLoadTypeReloadBypassingCache;
832 bool isBackForward = isBackForwardLoadType(frameLoadType); 832 bool isBackForward = isBackForwardLoadType(frameLoadType);
833 if (isFormSubmission) 833 if (isFormSubmission)
834 return (isReload || isBackForward) ? NavigationTypeFormResubmitted : Nav igationTypeFormSubmitted; 834 return (isReload || isBackForward) ? NavigationTypeFormResubmitted : Nav igationTypeFormSubmitted;
835 if (haveEvent) 835 if (haveEvent)
836 return NavigationTypeLinkClicked; 836 return NavigationTypeLinkClicked;
837 if (isReload) 837 if (isReload)
838 return NavigationTypeReload; 838 return NavigationTypeReload;
839 if (isBackForward) 839 if (isBackForward)
840 return NavigationTypeBackForward; 840 return NavigationTypeBackForward;
841 return NavigationTypeOther; 841 return NavigationTypeOther;
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
1264 } 1264 }
1265 checkCompleted(); 1265 checkCompleted();
1266 } 1266 }
1267 1267
1268 bool FrameLoader::shouldPerformFragmentNavigation(bool isFormSubmission, const S tring& httpMethod, FrameLoadType loadType, const KURL& url) 1268 bool FrameLoader::shouldPerformFragmentNavigation(bool isFormSubmission, const S tring& httpMethod, FrameLoadType loadType, const KURL& url)
1269 { 1269 {
1270 // We don't do this if we are submitting a form with method other than "GET" , explicitly reloading, 1270 // We don't do this if we are submitting a form with method other than "GET" , explicitly reloading,
1271 // currently displaying a frameset, or if the URL does not have a fragment. 1271 // currently displaying a frameset, or if the URL does not have a fragment.
1272 return (!isFormSubmission || equalIgnoringCase(httpMethod, HTTPNames::GET)) 1272 return (!isFormSubmission || equalIgnoringCase(httpMethod, HTTPNames::GET))
1273 && loadType != FrameLoadTypeReload 1273 && loadType != FrameLoadTypeReload
1274 && loadType != FrameLoadTypeReloadFromOrigin 1274 && loadType != FrameLoadTypeReloadBypassingCache
1275 && loadType != FrameLoadTypeSame 1275 && loadType != FrameLoadTypeSame
1276 && loadType != FrameLoadTypeBackForward 1276 && loadType != FrameLoadTypeBackForward
1277 && url.hasFragmentIdentifier() 1277 && url.hasFragmentIdentifier()
1278 && equalIgnoringFragmentIdentifier(m_frame->document()->url(), url) 1278 && equalIgnoringFragmentIdentifier(m_frame->document()->url(), url)
1279 // We don't want to just scroll if a link from within a 1279 // We don't want to just scroll if a link from within a
1280 // frameset is trying to reload the frameset into _top. 1280 // frameset is trying to reload the frameset into _top.
1281 && !m_frame->document()->isFrameSet(); 1281 && !m_frame->document()->isFrameSet();
1282 } 1282 }
1283 1283
1284 void FrameLoader::processFragment(const KURL& url, LoadStartType loadStartType) 1284 void FrameLoader::processFragment(const KURL& url, LoadStartType loadStartType)
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
1584 // FIXME: We need a way to propagate insecure requests policy flags to 1584 // FIXME: We need a way to propagate insecure requests policy flags to
1585 // out-of-process frames. For now, we'll always use default behavior. 1585 // out-of-process frames. For now, we'll always use default behavior.
1586 if (!parentFrame->isLocalFrame()) 1586 if (!parentFrame->isLocalFrame())
1587 return nullptr; 1587 return nullptr;
1588 1588
1589 ASSERT(toLocalFrame(parentFrame)->document()); 1589 ASSERT(toLocalFrame(parentFrame)->document());
1590 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade() ; 1590 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade() ;
1591 } 1591 }
1592 1592
1593 } // namespace blink 1593 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698