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

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

Issue 1156473002: Refactor FrameLoader loading interface (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Addressed Nate's comments 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 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 97
98 using namespace HTMLNames; 98 using namespace HTMLNames;
99 99
100 bool isBackForwardLoadType(FrameLoadType type) 100 bool isBackForwardLoadType(FrameLoadType type)
101 { 101 {
102 return type == FrameLoadTypeBackForward || type == FrameLoadTypeInitialHisto ryLoad; 102 return type == FrameLoadTypeBackForward || type == FrameLoadTypeInitialHisto ryLoad;
103 } 103 }
104 104
105 static bool needsHistoryItemRestore(FrameLoadType type) 105 static bool needsHistoryItemRestore(FrameLoadType type)
106 { 106 {
107 return type == FrameLoadTypeBackForward || type == FrameLoadTypeReload || ty pe == FrameLoadTypeReloadFromOrigin; 107 return type == FrameLoadTypeBackForward || type == FrameLoadTypeReload
108 || type == FrameLoadTypeReloadFromOrigin;
109 }
110
111 // static
112 ResourceRequest FrameLoader::resourceRequestFromHistoryItem(HistoryItem* item,
113 ResourceRequestCachePolicy cachePolicy)
114 {
115 RefPtr<FormData> formData = item->formData();
116 ResourceRequest request(item->url());
117 request.setHTTPReferrer(item->referrer());
118 request.setCachePolicy(cachePolicy);
119 if (formData) {
120 request.setHTTPMethod("POST");
121 request.setHTTPBody(formData);
122 request.setHTTPContentType(item->formContentType());
123 RefPtr<SecurityOrigin> securityOrigin = SecurityOrigin::createFromString (item->referrer().referrer);
124 request.addHTTPOriginIfNeeded(securityOrigin->toAtomicString());
125 }
126 return request;
127 }
128
129 ResourceRequest FrameLoader::resourceRequestForReload(FrameLoadType frameLoadTyp e,
130 const KURL& overrideURL, ClientRedirectPolicy clientRedirectPolicy)
131 {
132 ASSERT(frameLoadType == FrameLoadTypeReload || frameLoadType == FrameLoadTyp eReloadFromOrigin);
133 ResourceRequestCachePolicy cachePolicy = frameLoadType == FrameLoadTypeReloa dFromOrigin ?
134 ReloadBypassingCache : ReloadIgnoringCacheData;
135 if (!m_currentItem)
136 return ResourceRequest();
137 ResourceRequest request = resourceRequestFromHistoryItem(m_currentItem.get() , cachePolicy);
138
139 // ClientRedirectPolicy is an indication that this load was triggered by
140 // some direct interaction with the page. If this reload is not a client
141 // redirect, we should reuse the referrer from the original load of the
142 // current document. If this reload is a client redirect (e.g., location.rel oad()),
143 // it was initiated by something in the current document and should
144 // therefore show the current document's url as the referrer.
145 if (clientRedirectPolicy == ClientRedirect) {
146 request.setHTTPReferrer(Referrer(m_frame->document()->outgoingReferrer() ,
147 m_frame->document()->referrerPolicy()));
148 }
149
150 if (!overrideURL.isEmpty()) {
151 request.setURL(overrideURL);
152 request.clearHTTPReferrer();
153 }
154 request.setSkipServiceWorker(frameLoadType == FrameLoadTypeReloadFromOrigin) ;
155 return request;
108 } 156 }
109 157
110 FrameLoader::FrameLoader(LocalFrame* frame) 158 FrameLoader::FrameLoader(LocalFrame* frame)
111 : m_frame(frame) 159 : m_frame(frame)
112 , m_progressTracker(ProgressTracker::create(frame)) 160 , m_progressTracker(ProgressTracker::create(frame))
113 , m_loadType(FrameLoadTypeStandard) 161 , m_loadType(FrameLoadTypeStandard)
114 , m_inStopAllLoaders(false) 162 , m_inStopAllLoaders(false)
115 , m_checkTimer(this, &FrameLoader::checkTimerFired) 163 , m_checkTimer(this, &FrameLoader::checkTimerFired)
116 , m_didAccessInitialDocument(false) 164 , m_didAccessInitialDocument(false)
117 , m_didAccessInitialDocumentTimer(this, &FrameLoader::didAccessInitialDocume ntTimerFired) 165 , m_didAccessInitialDocumentTimer(this, &FrameLoader::didAccessInitialDocume ntTimerFired)
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 m_policyDocumentLoader->setDefersLoading(defers); 209 m_policyDocumentLoader->setDefersLoading(defers);
162 210
163 if (Document* document = m_frame->document()) { 211 if (Document* document = m_frame->document()) {
164 if (defers) 212 if (defers)
165 document->suspendScheduledTasks(); 213 document->suspendScheduledTasks();
166 else 214 else
167 document->resumeScheduledTasks(); 215 document->resumeScheduledTasks();
168 } 216 }
169 217
170 if (!defers) { 218 if (!defers) {
171 if (m_deferredHistoryLoad.isValid()) { 219 if (m_deferredHistoryLoad.get()) {
172 loadHistoryItem(m_deferredHistoryLoad.m_item.get(), FrameLoadTypeBac kForward, 220 load(FrameLoadRequest(nullptr, m_deferredHistoryLoad->m_request),
173 m_deferredHistoryLoad.m_type, m_deferredHistoryLoad.m_cachePolic y); 221 m_deferredHistoryLoad->m_loadType, m_deferredHistoryLoad->m_item .get(),
174 m_deferredHistoryLoad = DeferredHistoryLoad(); 222 m_deferredHistoryLoad->m_historyLoadType);
223 m_deferredHistoryLoad.clear();
175 } 224 }
176 m_frame->navigationScheduler().startTimer(); 225 m_frame->navigationScheduler().startTimer();
177 scheduleCheckCompleted(); 226 scheduleCheckCompleted();
178 } 227 }
179 } 228 }
180 229
181 void FrameLoader::saveScrollState() 230 void FrameLoader::saveScrollState()
182 { 231 {
183 if (!m_currentItem || !m_frame->view()) 232 if (!m_currentItem || !m_frame->view())
184 return; 233 return;
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 String headerContentLanguage = m_documentLoader->response().httpHeaderFi eld("Content-Language"); 439 String headerContentLanguage = m_documentLoader->response().httpHeaderFi eld("Content-Language");
391 if (!headerContentLanguage.isEmpty()) { 440 if (!headerContentLanguage.isEmpty()) {
392 size_t commaIndex = headerContentLanguage.find(','); 441 size_t commaIndex = headerContentLanguage.find(',');
393 headerContentLanguage.truncate(commaIndex); // kNotFound == -1 == do n't truncate 442 headerContentLanguage.truncate(commaIndex); // kNotFound == -1 == do n't truncate
394 headerContentLanguage = headerContentLanguage.stripWhiteSpace(isHTML Space<UChar>); 443 headerContentLanguage = headerContentLanguage.stripWhiteSpace(isHTML Space<UChar>);
395 if (!headerContentLanguage.isEmpty()) 444 if (!headerContentLanguage.isEmpty())
396 m_frame->document()->setContentLanguage(AtomicString(headerConte ntLanguage)); 445 m_frame->document()->setContentLanguage(AtomicString(headerConte ntLanguage));
397 } 446 }
398 } 447 }
399 448
400 if (m_provisionalItem && (m_loadType == FrameLoadTypeBackForward || m_loadTy pe == FrameLoadTypeInitialHistoryLoad)) 449 if (m_provisionalItem && isBackForwardLoadType(m_loadType))
401 m_frame->document()->setStateForNewFormElements(m_provisionalItem->docum entState()); 450 m_frame->document()->setStateForNewFormElements(m_provisionalItem->docum entState());
402 451
403 client()->didCreateNewDocument(); 452 client()->didCreateNewDocument();
404 } 453 }
405 454
406 void FrameLoader::finishedParsing() 455 void FrameLoader::finishedParsing()
407 { 456 {
408 if (m_stateMachine.creatingInitialEmptyDocument()) 457 if (m_stateMachine.creatingInitialEmptyDocument())
409 return; 458 return;
410 459
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 KeyboardEvent* keyEvent = toKeyboardEvent(event); 805 KeyboardEvent* keyEvent = toKeyboardEvent(event);
757 navigationPolicyFromMouseEvent(0, keyEvent->ctrlKey(), keyEvent->shiftKe y(), keyEvent->altKey(), keyEvent->metaKey(), &policy); 806 navigationPolicyFromMouseEvent(0, keyEvent->ctrlKey(), keyEvent->shiftKe y(), keyEvent->altKey(), keyEvent->metaKey(), &policy);
758 } else if (event->isGestureEvent()) { 807 } else if (event->isGestureEvent()) {
759 // The click is simulated when triggering the gesture-tap event 808 // The click is simulated when triggering the gesture-tap event
760 GestureEvent* gestureEvent = toGestureEvent(event); 809 GestureEvent* gestureEvent = toGestureEvent(event);
761 navigationPolicyFromMouseEvent(0, gestureEvent->ctrlKey(), gestureEvent- >shiftKey(), gestureEvent->altKey(), gestureEvent->metaKey(), &policy); 810 navigationPolicyFromMouseEvent(0, gestureEvent->ctrlKey(), gestureEvent- >shiftKey(), gestureEvent->altKey(), gestureEvent->metaKey(), &policy);
762 } 811 }
763 return policy; 812 return policy;
764 } 813 }
765 814
766 void FrameLoader::load(const FrameLoadRequest& passedRequest) 815 void FrameLoader::load(const FrameLoadRequest& passedRequest, FrameLoadType fram eLoadType,
816 HistoryItem* historyItem, HistoryLoadType historyLoadType)
767 { 817 {
768 ASSERT(m_frame->document()); 818 ASSERT(m_frame->document());
769 819
770 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); 820 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get());
771 821
772 if (m_inStopAllLoaders) 822 if (m_inStopAllLoaders)
773 return; 823 return;
774 824
825 if (m_frame->page()->defersLoading() && isBackForwardLoadType(frameLoadType) ) {
826 m_deferredHistoryLoad = adoptPtr(new DeferredHistoryLoad(
827 passedRequest.resourceRequest(), historyItem, frameLoadType, history LoadType));
828 return;
829 }
830
775 FrameLoadRequest request(passedRequest); 831 FrameLoadRequest request(passedRequest);
776 request.resourceRequest().setHasUserGesture(UserGestureIndicator::processing UserGesture()); 832 request.resourceRequest().setHasUserGesture(UserGestureIndicator::processing UserGesture());
777 833
778 if (!prepareRequestForThisFrame(request)) 834 if (!prepareRequestForThisFrame(request))
779 return; 835 return;
780 836
837 if (isBackForwardLoadType(frameLoadType)) {
838 ASSERT(historyItem);
839 m_provisionalItem = historyItem;
840 }
841
781 RefPtrWillBeRawPtr<LocalFrame> targetFrame = toLocalFrame(request.form() ? n ullptr : m_frame->findFrameForNavigation(AtomicString(request.frameName()), *m_f rame)); 842 RefPtrWillBeRawPtr<LocalFrame> targetFrame = toLocalFrame(request.form() ? n ullptr : m_frame->findFrameForNavigation(AtomicString(request.frameName()), *m_f rame));
782 if (targetFrame && targetFrame.get() != m_frame) { 843 if (targetFrame && targetFrame.get() != m_frame) {
783 bool wasInSamePage = targetFrame->page() == m_frame->page(); 844 bool wasInSamePage = targetFrame->page() == m_frame->page();
784 845
785 request.setFrameName("_self"); 846 request.setFrameName("_self");
786 targetFrame->loader().load(request); 847 targetFrame->loader().load(request);
787 Page* page = targetFrame->page(); 848 Page* page = targetFrame->page();
788 if (!wasInSamePage && page) 849 if (!wasInSamePage && page)
789 page->chromeClient().focus(); 850 page->chromeClient().focus();
790 return; 851 return;
791 } 852 }
792 853
793 setReferrerForFrameRequest(request.resourceRequest(), request.shouldSendRefe rrer(), request.originDocument()); 854 setReferrerForFrameRequest(request.resourceRequest(), request.shouldSendRefe rrer(), request.originDocument());
794 855
795 FrameLoadType newLoadType = determineFrameLoadType(request); 856 FrameLoadType newLoadType = (frameLoadType == FrameLoadTypeStandard) ?
857 determineFrameLoadType(request) : frameLoadType;
796 NavigationPolicy policy = navigationPolicyForRequest(request); 858 NavigationPolicy policy = navigationPolicyForRequest(request);
797 if (shouldOpenInNewWindow(targetFrame.get(), request, policy)) { 859 if (shouldOpenInNewWindow(targetFrame.get(), request, policy)) {
798 if (policy == NavigationPolicyDownload) { 860 if (policy == NavigationPolicyDownload) {
799 client()->loadURLExternally(request.resourceRequest(), NavigationPol icyDownload); 861 client()->loadURLExternally(request.resourceRequest(), NavigationPol icyDownload);
800 } else { 862 } else {
801 request.resourceRequest().setFrameType(WebURLRequest::FrameTypeAuxil iary); 863 request.resourceRequest().setFrameType(WebURLRequest::FrameTypeAuxil iary);
802 createWindowForRequest(request, *m_frame, policy, request.shouldSend Referrer()); 864 createWindowForRequest(request, *m_frame, policy, request.shouldSend Referrer());
803 } 865 }
804 return; 866 return;
805 } 867 }
806 868
807 const KURL& url = request.resourceRequest().url(); 869 const KURL& url = request.resourceRequest().url();
808 if (policy == NavigationPolicyCurrentTab && shouldPerformFragmentNavigation( request.form(), request.resourceRequest().httpMethod(), newLoadType, url)) { 870 bool sameDocumentHistoryNavigation =
809 m_documentLoader->setNavigationType(determineNavigationType(newLoadType, false, request.triggeringEvent())); 871 isBackForwardLoadType(newLoadType) && historyLoadType == HistorySameDocu mentLoad;
810 if (shouldTreatURLAsSameAsCurrent(url)) 872 bool sameDocumentNavigation = policy == NavigationPolicyCurrentTab
811 newLoadType = FrameLoadTypeRedirectWithLockedBackForwardList; 873 && shouldPerformFragmentNavigation(
812 loadInSameDocument(url, nullptr, newLoadType, request.clientRedirect()); 874 request.form(), request.resourceRequest().httpMethod(), newLoadType, url);
875
876 // Perform same document navigation.
877 if (sameDocumentHistoryNavigation || sameDocumentNavigation) {
878 ASSERT(historyItem || !sameDocumentHistoryNavigation);
879 RefPtr<SerializedScriptValue> stateObject = sameDocumentHistoryNavigatio n ?
880 historyItem->stateObject() : nullptr;
881
882 if (!sameDocumentHistoryNavigation) {
883 m_documentLoader->setNavigationType(determineNavigationType(
884 newLoadType, false, request.triggeringEvent()));
885 if (shouldTreatURLAsSameAsCurrent(url))
886 newLoadType = FrameLoadTypeRedirectWithLockedBackForwardList;
887 }
888
889 loadInSameDocument(url, stateObject, newLoadType, request.clientRedirect ());
890
891 if (sameDocumentHistoryNavigation)
892 restoreScrollPositionAndViewState();
813 return; 893 return;
814 } 894 }
895
896 // Perform navigation to a different document.
815 bool sameURL = url == m_documentLoader->urlForHistory(); 897 bool sameURL = url == m_documentLoader->urlForHistory();
816 startLoad(request, newLoadType, policy); 898 startLoad(request, newLoadType, policy);
899
817 // Example of this case are sites that reload the same URL with a different cookie 900 // Example of this case are sites that reload the same URL with a different cookie
818 // driving the generated content, or a master frame with links that drive a target 901 // driving the generated content, or a master frame with links that drive a target
819 // frame, where the user has clicked on the same link repeatedly. 902 // frame, where the user has clicked on the same link repeatedly.
820 if (sameURL && newLoadType != FrameLoadTypeReload && newLoadType != FrameLoa dTypeReloadFromOrigin && request.resourceRequest().httpMethod() != "POST") 903 if (sameURL
904 && !isBackForwardLoadType(frameLoadType)
905 && newLoadType != FrameLoadTypeReload
906 && newLoadType != FrameLoadTypeReloadFromOrigin
907 && request.resourceRequest().httpMethod() != "POST") {
821 m_loadType = FrameLoadTypeSame; 908 m_loadType = FrameLoadTypeSame;
909 }
822 } 910 }
823 911
824 SubstituteData FrameLoader::defaultSubstituteDataForURL(const KURL& url) 912 SubstituteData FrameLoader::defaultSubstituteDataForURL(const KURL& url)
825 { 913 {
826 if (!shouldTreatURLAsSrcdocDocument(url)) 914 if (!shouldTreatURLAsSrcdocDocument(url))
827 return SubstituteData(); 915 return SubstituteData();
828 String srcdoc = m_frame->deprecatedLocalOwner()->fastGetAttribute(srcdocAttr ); 916 String srcdoc = m_frame->deprecatedLocalOwner()->fastGetAttribute(srcdocAttr );
829 ASSERT(!srcdoc.isNull()); 917 ASSERT(!srcdoc.isNull());
830 CString encodedSrcdoc = srcdoc.utf8(); 918 CString encodedSrcdoc = srcdoc.utf8();
831 return SubstituteData(SharedBuffer::create(encodedSrcdoc.data(), encodedSrcd oc.length()), "text/html", "UTF-8", KURL()); 919 return SubstituteData(SharedBuffer::create(encodedSrcdoc.data(), encodedSrcd oc.length()), "text/html", "UTF-8", KURL());
832 } 920 }
833 921
834 void FrameLoader::reportLocalLoadFailed(LocalFrame* frame, const String& url) 922 void FrameLoader::reportLocalLoadFailed(LocalFrame* frame, const String& url)
835 { 923 {
836 ASSERT(!url.isEmpty()); 924 ASSERT(!url.isEmpty());
837 if (!frame) 925 if (!frame)
838 return; 926 return;
839 927
840 frame->document()->addConsoleMessage(ConsoleMessage::create(SecurityMessageS ource, ErrorMessageLevel, "Not allowed to load local resource: " + url)); 928 frame->document()->addConsoleMessage(ConsoleMessage::create(SecurityMessageS ource, ErrorMessageLevel, "Not allowed to load local resource: " + url));
841 } 929 }
842 930
843 // static
844 ResourceRequest FrameLoader::requestFromHistoryItem(HistoryItem* item, ResourceR equestCachePolicy cachePolicy)
845 {
846 RefPtr<FormData> formData = item->formData();
847 ResourceRequest request(item->url());
848 request.setHTTPReferrer(item->referrer());
849 request.setCachePolicy(cachePolicy);
850 if (formData) {
851 request.setHTTPMethod("POST");
852 request.setHTTPBody(formData);
853 request.setHTTPContentType(item->formContentType());
854 RefPtr<SecurityOrigin> securityOrigin = SecurityOrigin::createFromString (item->referrer().referrer);
855 request.addHTTPOriginIfNeeded(securityOrigin->toAtomicString());
856 }
857 return request;
858 }
859
860 void FrameLoader::reload(ReloadPolicy reloadPolicy, const KURL& overrideURL, Cli entRedirectPolicy clientRedirectPolicy)
861 {
862 if (!m_currentItem)
863 return;
864
865 ResourceRequestCachePolicy cachePolicy = reloadPolicy == EndToEndReload ? Re loadBypassingCache : ReloadIgnoringCacheData;
866 ResourceRequest request = requestFromHistoryItem(m_currentItem.get(), cacheP olicy);
867
868 // ClientRedirectPolicy is an indication that this load was triggered by
869 // some direct interaction with the page. If this reload is not a client
870 // redirect, we should reuse the referrer from the original load of the
871 // current document. If this reload is a client redirect (e.g., location.rel oad()),
872 // it was initiated by something in the current document and should
873 // therefore show the current document's url as the referrer.
874 if (clientRedirectPolicy == ClientRedirect)
875 request.setHTTPReferrer(Referrer(m_frame->document()->outgoingReferrer() , m_frame->document()->referrerPolicy()));
876
877 if (!overrideURL.isEmpty()) {
878 request.setURL(overrideURL);
879 request.clearHTTPReferrer();
880 }
881 request.setSkipServiceWorker(reloadPolicy == EndToEndReload);
882 FrameLoadRequest frameLoadRequest(nullptr, request);
883 frameLoadRequest.setClientRedirect(clientRedirectPolicy);
884 startLoad(frameLoadRequest, reloadPolicy == EndToEndReload ? FrameLoadTypeRe loadFromOrigin : FrameLoadTypeReload, NavigationPolicyCurrentTab);
885 }
886
887 void FrameLoader::stopAllLoaders() 931 void FrameLoader::stopAllLoaders()
888 { 932 {
889 if (m_frame->document()->pageDismissalEventBeingDispatched() != Document::No Dismissal) 933 if (m_frame->document()->pageDismissalEventBeingDispatched() != Document::No Dismissal)
890 return; 934 return;
891 935
892 // If this method is called from within this method, infinite recursion can occur (3442218). Avoid this. 936 // If this method is called from within this method, infinite recursion can occur (3442218). Avoid this.
893 if (m_inStopAllLoaders) 937 if (m_inStopAllLoaders)
894 return; 938 return;
895 939
896 // Calling stopLoading() on the provisional document loader can blow away 940 // Calling stopLoading() on the provisional document loader can blow away
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
1125 if (!m_provisionalDocumentLoader && m_frame->isLoading()) { 1169 if (!m_provisionalDocumentLoader && m_frame->isLoading()) {
1126 client()->dispatchDidFailLoad(error, historyCommitType); 1170 client()->dispatchDidFailLoad(error, historyCommitType);
1127 m_progressTracker->progressCompleted(); 1171 m_progressTracker->progressCompleted();
1128 } 1172 }
1129 } 1173 }
1130 checkCompleted(); 1174 checkCompleted();
1131 } 1175 }
1132 1176
1133 bool FrameLoader::shouldPerformFragmentNavigation(bool isFormSubmission, const S tring& httpMethod, FrameLoadType loadType, const KURL& url) 1177 bool FrameLoader::shouldPerformFragmentNavigation(bool isFormSubmission, const S tring& httpMethod, FrameLoadType loadType, const KURL& url)
1134 { 1178 {
1135 ASSERT(loadType != FrameLoadTypeReloadFromOrigin);
1136 // We don't do this if we are submitting a form with method other than "GET" , explicitly reloading, 1179 // We don't do this if we are submitting a form with method other than "GET" , explicitly reloading,
1137 // currently displaying a frameset, or if the URL does not have a fragment. 1180 // currently displaying a frameset, or if the URL does not have a fragment.
1138 return (!isFormSubmission || equalIgnoringCase(httpMethod, "GET")) 1181 return (!isFormSubmission || equalIgnoringCase(httpMethod, "GET"))
1139 && loadType != FrameLoadTypeReload 1182 && loadType != FrameLoadTypeReload
1183 && loadType != FrameLoadTypeReloadFromOrigin
1140 && loadType != FrameLoadTypeSame 1184 && loadType != FrameLoadTypeSame
1141 && loadType != FrameLoadTypeBackForward 1185 && loadType != FrameLoadTypeBackForward
1142 && url.hasFragmentIdentifier() 1186 && url.hasFragmentIdentifier()
1143 && equalIgnoringFragmentIdentifier(m_frame->document()->url(), url) 1187 && equalIgnoringFragmentIdentifier(m_frame->document()->url(), url)
1144 // We don't want to just scroll if a link from within a 1188 // We don't want to just scroll if a link from within a
1145 // frameset is trying to reload the frameset into _top. 1189 // frameset is trying to reload the frameset into _top.
1146 && !m_frame->document()->isFrameSet(); 1190 && !m_frame->document()->isFrameSet();
1147 } 1191 }
1148 1192
1149 void FrameLoader::scrollToFragmentWithParentBoundary(const KURL& url) 1193 void FrameLoader::scrollToFragmentWithParentBoundary(const KURL& url)
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
1335 bool FrameLoader::shouldTreatURLAsSrcdocDocument(const KURL& url) const 1379 bool FrameLoader::shouldTreatURLAsSrcdocDocument(const KURL& url) const
1336 { 1380 {
1337 if (!equalIgnoringCase(url.string(), "about:srcdoc")) 1381 if (!equalIgnoringCase(url.string(), "about:srcdoc"))
1338 return false; 1382 return false;
1339 HTMLFrameOwnerElement* ownerElement = m_frame->deprecatedLocalOwner(); 1383 HTMLFrameOwnerElement* ownerElement = m_frame->deprecatedLocalOwner();
1340 if (!isHTMLIFrameElement(ownerElement)) 1384 if (!isHTMLIFrameElement(ownerElement))
1341 return false; 1385 return false;
1342 return ownerElement->fastHasAttribute(srcdocAttr); 1386 return ownerElement->fastHasAttribute(srcdocAttr);
1343 } 1387 }
1344 1388
1345 void FrameLoader::loadHistoryItem(HistoryItem* item, FrameLoadType frameLoadType , HistoryLoadType historyLoadType, ResourceRequestCachePolicy cachePolicy)
1346 {
1347 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get());
1348 if (m_frame->page()->defersLoading()) {
1349 m_deferredHistoryLoad = DeferredHistoryLoad(item, historyLoadType, cache Policy);
1350 return;
1351 }
1352
1353 m_provisionalItem = item;
1354 if (historyLoadType == HistorySameDocumentLoad) {
1355 loadInSameDocument(item->url(), item->stateObject(), frameLoadType, NotC lientRedirect);
1356 restoreScrollPositionAndViewState();
1357 return;
1358 }
1359 FrameLoadRequest request(nullptr, requestFromHistoryItem(item, cachePolicy)) ;
1360 startLoad(request, frameLoadType, NavigationPolicyCurrentTab);
1361 }
1362
1363 void FrameLoader::dispatchDocumentElementAvailable() 1389 void FrameLoader::dispatchDocumentElementAvailable()
1364 { 1390 {
1365 client()->documentElementAvailable(); 1391 client()->documentElementAvailable();
1366 } 1392 }
1367 1393
1368 void FrameLoader::dispatchDidClearDocumentOfWindowObject() 1394 void FrameLoader::dispatchDidClearDocumentOfWindowObject()
1369 { 1395 {
1370 if (!m_frame->script().canExecuteScripts(NotAboutToExecuteScript)) 1396 if (!m_frame->script().canExecuteScripts(NotAboutToExecuteScript))
1371 return; 1397 return;
1372 1398
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1444 // FIXME: We need a way to propagate insecure requests policy flags to 1470 // FIXME: We need a way to propagate insecure requests policy flags to
1445 // out-of-process frames. For now, we'll always use default behavior. 1471 // out-of-process frames. For now, we'll always use default behavior.
1446 if (!parentFrame->isLocalFrame()) 1472 if (!parentFrame->isLocalFrame())
1447 return nullptr; 1473 return nullptr;
1448 1474
1449 ASSERT(toLocalFrame(parentFrame)->document()); 1475 ASSERT(toLocalFrame(parentFrame)->document());
1450 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade() ; 1476 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade() ;
1451 } 1477 }
1452 1478
1453 } // namespace blink 1479 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698