OLD | NEW |
---|---|
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 Loading... | |
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; | |
156 } | |
157 | |
158 // static | |
159 FrameLoadRequest FrameLoader::frameRequestForReload(const ResourceRequest& resou rceRequest, | |
160 ClientRedirectPolicy clientRedirectPolicy) | |
161 { | |
162 FrameLoadRequest request = FrameLoadRequest(nullptr, resourceRequest); | |
163 request.setClientRedirect(clientRedirectPolicy); | |
164 return request; | |
108 } | 165 } |
109 | 166 |
110 FrameLoader::FrameLoader(LocalFrame* frame) | 167 FrameLoader::FrameLoader(LocalFrame* frame) |
111 : m_frame(frame) | 168 : m_frame(frame) |
112 , m_progressTracker(ProgressTracker::create(frame)) | 169 , m_progressTracker(ProgressTracker::create(frame)) |
113 , m_loadType(FrameLoadTypeStandard) | 170 , m_loadType(FrameLoadTypeStandard) |
114 , m_inStopAllLoaders(false) | 171 , m_inStopAllLoaders(false) |
115 , m_checkTimer(this, &FrameLoader::checkTimerFired) | 172 , m_checkTimer(this, &FrameLoader::checkTimerFired) |
116 , m_didAccessInitialDocument(false) | 173 , m_didAccessInitialDocument(false) |
117 , m_didAccessInitialDocumentTimer(this, &FrameLoader::didAccessInitialDocume ntTimerFired) | 174 , m_didAccessInitialDocumentTimer(this, &FrameLoader::didAccessInitialDocume ntTimerFired) |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
161 m_policyDocumentLoader->setDefersLoading(defers); | 218 m_policyDocumentLoader->setDefersLoading(defers); |
162 | 219 |
163 if (Document* document = m_frame->document()) { | 220 if (Document* document = m_frame->document()) { |
164 if (defers) | 221 if (defers) |
165 document->suspendScheduledTasks(); | 222 document->suspendScheduledTasks(); |
166 else | 223 else |
167 document->resumeScheduledTasks(); | 224 document->resumeScheduledTasks(); |
168 } | 225 } |
169 | 226 |
170 if (!defers) { | 227 if (!defers) { |
171 if (m_deferredHistoryLoad.isValid()) { | 228 if (m_deferredHistoryLoad.get()) { |
172 loadHistoryItem(m_deferredHistoryLoad.m_item.get(), FrameLoadTypeBac kForward, | 229 load(FrameLoadRequest(nullptr, m_deferredHistoryLoad->m_request), |
173 m_deferredHistoryLoad.m_type, m_deferredHistoryLoad.m_cachePolic y); | 230 m_deferredHistoryLoad->m_loadType, m_deferredHistoryLoad->m_item .get(), |
174 m_deferredHistoryLoad = DeferredHistoryLoad(); | 231 m_deferredHistoryLoad->m_historyLoadType); |
232 m_deferredHistoryLoad.clear(); | |
175 } | 233 } |
176 m_frame->navigationScheduler().startTimer(); | 234 m_frame->navigationScheduler().startTimer(); |
177 scheduleCheckCompleted(); | 235 scheduleCheckCompleted(); |
178 } | 236 } |
179 } | 237 } |
180 | 238 |
181 void FrameLoader::saveScrollState() | 239 void FrameLoader::saveScrollState() |
182 { | 240 { |
183 if (!m_currentItem || !m_frame->view()) | 241 if (!m_currentItem || !m_frame->view()) |
184 return; | 242 return; |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
387 String headerContentLanguage = m_documentLoader->response().httpHeaderFi eld("Content-Language"); | 445 String headerContentLanguage = m_documentLoader->response().httpHeaderFi eld("Content-Language"); |
388 if (!headerContentLanguage.isEmpty()) { | 446 if (!headerContentLanguage.isEmpty()) { |
389 size_t commaIndex = headerContentLanguage.find(','); | 447 size_t commaIndex = headerContentLanguage.find(','); |
390 headerContentLanguage.truncate(commaIndex); // kNotFound == -1 == do n't truncate | 448 headerContentLanguage.truncate(commaIndex); // kNotFound == -1 == do n't truncate |
391 headerContentLanguage = headerContentLanguage.stripWhiteSpace(isHTML Space<UChar>); | 449 headerContentLanguage = headerContentLanguage.stripWhiteSpace(isHTML Space<UChar>); |
392 if (!headerContentLanguage.isEmpty()) | 450 if (!headerContentLanguage.isEmpty()) |
393 m_frame->document()->setContentLanguage(AtomicString(headerConte ntLanguage)); | 451 m_frame->document()->setContentLanguage(AtomicString(headerConte ntLanguage)); |
394 } | 452 } |
395 } | 453 } |
396 | 454 |
397 if (m_provisionalItem && (m_loadType == FrameLoadTypeBackForward || m_loadTy pe == FrameLoadTypeInitialHistoryLoad)) | 455 if (m_provisionalItem && isBackForwardLoadType(m_loadType)) |
398 m_frame->document()->setStateForNewFormElements(m_provisionalItem->docum entState()); | 456 m_frame->document()->setStateForNewFormElements(m_provisionalItem->docum entState()); |
399 | 457 |
400 client()->didCreateNewDocument(); | 458 client()->didCreateNewDocument(); |
401 } | 459 } |
402 | 460 |
403 void FrameLoader::finishedParsing() | 461 void FrameLoader::finishedParsing() |
404 { | 462 { |
405 if (m_stateMachine.creatingInitialEmptyDocument()) | 463 if (m_stateMachine.creatingInitialEmptyDocument()) |
406 return; | 464 return; |
407 | 465 |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
749 KeyboardEvent* keyEvent = toKeyboardEvent(event); | 807 KeyboardEvent* keyEvent = toKeyboardEvent(event); |
750 navigationPolicyFromMouseEvent(0, keyEvent->ctrlKey(), keyEvent->shiftKe y(), keyEvent->altKey(), keyEvent->metaKey(), &policy); | 808 navigationPolicyFromMouseEvent(0, keyEvent->ctrlKey(), keyEvent->shiftKe y(), keyEvent->altKey(), keyEvent->metaKey(), &policy); |
751 } else if (event->isGestureEvent()) { | 809 } else if (event->isGestureEvent()) { |
752 // The click is simulated when triggering the gesture-tap event | 810 // The click is simulated when triggering the gesture-tap event |
753 GestureEvent* gestureEvent = toGestureEvent(event); | 811 GestureEvent* gestureEvent = toGestureEvent(event); |
754 navigationPolicyFromMouseEvent(0, gestureEvent->ctrlKey(), gestureEvent- >shiftKey(), gestureEvent->altKey(), gestureEvent->metaKey(), &policy); | 812 navigationPolicyFromMouseEvent(0, gestureEvent->ctrlKey(), gestureEvent- >shiftKey(), gestureEvent->altKey(), gestureEvent->metaKey(), &policy); |
755 } | 813 } |
756 return policy; | 814 return policy; |
757 } | 815 } |
758 | 816 |
759 void FrameLoader::load(const FrameLoadRequest& passedRequest) | 817 void FrameLoader::load(const FrameLoadRequest& passedRequest, FrameLoadType fram eLoadType, |
818 HistoryItem* historyItem, HistoryLoadType historyLoadType) | |
760 { | 819 { |
761 ASSERT(m_frame->document()); | 820 ASSERT(m_frame->document()); |
762 | 821 |
763 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); | 822 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); |
764 | 823 |
765 if (m_inStopAllLoaders) | 824 if (m_inStopAllLoaders) |
766 return; | 825 return; |
767 | 826 |
827 if (m_frame->page()->defersLoading() && isBackForwardLoadType(frameLoadType) ) { | |
828 m_deferredHistoryLoad = adoptPtr(new DeferredHistoryLoad( | |
829 passedRequest.resourceRequest(), historyItem, frameLoadType, history LoadType)); | |
830 return; | |
831 } | |
832 | |
768 FrameLoadRequest request(passedRequest); | 833 FrameLoadRequest request(passedRequest); |
769 request.resourceRequest().setHasUserGesture(UserGestureIndicator::processing UserGesture()); | 834 request.resourceRequest().setHasUserGesture(UserGestureIndicator::processing UserGesture()); |
770 | 835 |
771 if (!prepareRequestForThisFrame(request)) | 836 if (!prepareRequestForThisFrame(request)) |
772 return; | 837 return; |
773 | 838 |
839 if (isBackForwardLoadType(frameLoadType)) { | |
840 ASSERT(historyItem); | |
841 m_provisionalItem = historyItem; | |
842 } | |
843 | |
774 RefPtrWillBeRawPtr<LocalFrame> targetFrame = toLocalFrame(request.form() ? n ullptr : m_frame->findFrameForNavigation(AtomicString(request.frameName()), *m_f rame)); | 844 RefPtrWillBeRawPtr<LocalFrame> targetFrame = toLocalFrame(request.form() ? n ullptr : m_frame->findFrameForNavigation(AtomicString(request.frameName()), *m_f rame)); |
775 if (targetFrame && targetFrame.get() != m_frame) { | 845 if (targetFrame && targetFrame.get() != m_frame) { |
776 bool wasInSamePage = targetFrame->page() == m_frame->page(); | 846 bool wasInSamePage = targetFrame->page() == m_frame->page(); |
777 | 847 |
778 request.setFrameName("_self"); | 848 request.setFrameName("_self"); |
779 targetFrame->loader().load(request); | 849 targetFrame->loader().load(request); |
780 Page* page = targetFrame->page(); | 850 Page* page = targetFrame->page(); |
781 if (!wasInSamePage && page) | 851 if (!wasInSamePage && page) |
782 page->chromeClient().focus(); | 852 page->chromeClient().focus(); |
783 return; | 853 return; |
784 } | 854 } |
785 | 855 |
786 setReferrerForFrameRequest(request.resourceRequest(), request.shouldSendRefe rrer(), request.originDocument()); | 856 setReferrerForFrameRequest(request.resourceRequest(), request.shouldSendRefe rrer(), request.originDocument()); |
787 | 857 |
788 FrameLoadType newLoadType = determineFrameLoadType(request); | 858 FrameLoadType newLoadType = (frameLoadType == FrameLoadTypeStandard) ? |
859 determineFrameLoadType(request) : frameLoadType; | |
789 NavigationPolicy policy = navigationPolicyForRequest(request); | 860 NavigationPolicy policy = navigationPolicyForRequest(request); |
790 if (shouldOpenInNewWindow(targetFrame.get(), request, policy)) { | 861 if (shouldOpenInNewWindow(targetFrame.get(), request, policy)) { |
791 if (policy == NavigationPolicyDownload) { | 862 if (policy == NavigationPolicyDownload) { |
792 client()->loadURLExternally(request.resourceRequest(), NavigationPol icyDownload); | 863 client()->loadURLExternally(request.resourceRequest(), NavigationPol icyDownload); |
793 } else { | 864 } else { |
794 request.resourceRequest().setFrameType(WebURLRequest::FrameTypeAuxil iary); | 865 request.resourceRequest().setFrameType(WebURLRequest::FrameTypeAuxil iary); |
795 createWindowForRequest(request, *m_frame, policy, request.shouldSend Referrer()); | 866 createWindowForRequest(request, *m_frame, policy, request.shouldSend Referrer()); |
796 } | 867 } |
797 return; | 868 return; |
798 } | 869 } |
799 | 870 |
800 const KURL& url = request.resourceRequest().url(); | 871 const KURL& url = request.resourceRequest().url(); |
801 if (policy == NavigationPolicyCurrentTab && shouldPerformFragmentNavigation( request.form(), request.resourceRequest().httpMethod(), newLoadType, url)) { | 872 bool sameDocumentHistoryNavigation = |
802 m_documentLoader->setNavigationType(determineNavigationType(newLoadType, false, request.triggeringEvent())); | 873 isBackForwardLoadType(newLoadType) && historyLoadType == HistorySameDocu mentLoad; |
803 if (shouldTreatURLAsSameAsCurrent(url)) | 874 bool sameDocumentNavigation = policy == NavigationPolicyCurrentTab |
804 newLoadType = FrameLoadTypeRedirectWithLockedBackForwardList; | 875 && shouldPerformFragmentNavigation( |
805 loadInSameDocument(url, nullptr, newLoadType, request.clientRedirect()); | 876 request.form(), request.resourceRequest().httpMethod(), newLoadType, url); |
877 | |
878 // Perform same document navigation. | |
879 if (sameDocumentHistoryNavigation || sameDocumentNavigation) { | |
880 ASSERT(historyItem || !sameDocumentHistoryNavigation); | |
881 RefPtr<SerializedScriptValue> stateObject = sameDocumentHistoryNavigatio n ? | |
882 historyItem->stateObject() : nullptr; | |
883 ClientRedirectPolicy clientRedirect = sameDocumentHistoryNavigation ? | |
Nate Chapin
2015/06/04 23:23:09
I think (though I'm not absolutely sure) that a hi
clamy
2015/06/05 14:11:48
Done (if the tests appear to fail I will bring it
| |
884 NotClientRedirect : request.clientRedirect(); | |
885 | |
886 if (!sameDocumentHistoryNavigation) { | |
887 m_documentLoader->setNavigationType(determineNavigationType( | |
888 newLoadType, false, request.triggeringEvent())); | |
889 if (shouldTreatURLAsSameAsCurrent(url)) | |
890 newLoadType = FrameLoadTypeRedirectWithLockedBackForwardList; | |
891 } | |
892 | |
893 loadInSameDocument(url, stateObject, newLoadType, clientRedirect); | |
894 | |
895 if (sameDocumentNavigation) | |
896 restoreScrollPositionAndViewState(); | |
806 return; | 897 return; |
807 } | 898 } |
899 | |
900 // Perform navigation to a different document. | |
808 bool sameURL = url == m_documentLoader->urlForHistory(); | 901 bool sameURL = url == m_documentLoader->urlForHistory(); |
809 startLoad(request, newLoadType, policy); | 902 startLoad(request, newLoadType, policy); |
903 | |
810 // Example of this case are sites that reload the same URL with a different cookie | 904 // Example of this case are sites that reload the same URL with a different cookie |
811 // driving the generated content, or a master frame with links that drive a target | 905 // driving the generated content, or a master frame with links that drive a target |
812 // frame, where the user has clicked on the same link repeatedly. | 906 // frame, where the user has clicked on the same link repeatedly. |
813 if (sameURL && newLoadType != FrameLoadTypeReload && newLoadType != FrameLoa dTypeReloadFromOrigin && request.resourceRequest().httpMethod() != "POST") | 907 if (sameURL |
908 && !isBackForwardLoadType(frameLoadType) | |
909 && newLoadType != FrameLoadTypeReload | |
910 && newLoadType != FrameLoadTypeReloadFromOrigin | |
911 && request.resourceRequest().httpMethod() != "POST") { | |
814 m_loadType = FrameLoadTypeSame; | 912 m_loadType = FrameLoadTypeSame; |
913 } | |
815 } | 914 } |
816 | 915 |
817 SubstituteData FrameLoader::defaultSubstituteDataForURL(const KURL& url) | 916 SubstituteData FrameLoader::defaultSubstituteDataForURL(const KURL& url) |
818 { | 917 { |
819 if (!shouldTreatURLAsSrcdocDocument(url)) | 918 if (!shouldTreatURLAsSrcdocDocument(url)) |
820 return SubstituteData(); | 919 return SubstituteData(); |
821 String srcdoc = m_frame->deprecatedLocalOwner()->fastGetAttribute(srcdocAttr ); | 920 String srcdoc = m_frame->deprecatedLocalOwner()->fastGetAttribute(srcdocAttr ); |
822 ASSERT(!srcdoc.isNull()); | 921 ASSERT(!srcdoc.isNull()); |
823 CString encodedSrcdoc = srcdoc.utf8(); | 922 CString encodedSrcdoc = srcdoc.utf8(); |
824 return SubstituteData(SharedBuffer::create(encodedSrcdoc.data(), encodedSrcd oc.length()), "text/html", "UTF-8", KURL()); | 923 return SubstituteData(SharedBuffer::create(encodedSrcdoc.data(), encodedSrcd oc.length()), "text/html", "UTF-8", KURL()); |
825 } | 924 } |
826 | 925 |
827 void FrameLoader::reportLocalLoadFailed(LocalFrame* frame, const String& url) | 926 void FrameLoader::reportLocalLoadFailed(LocalFrame* frame, const String& url) |
828 { | 927 { |
829 ASSERT(!url.isEmpty()); | 928 ASSERT(!url.isEmpty()); |
830 if (!frame) | 929 if (!frame) |
831 return; | 930 return; |
832 | 931 |
833 frame->document()->addConsoleMessage(ConsoleMessage::create(SecurityMessageS ource, ErrorMessageLevel, "Not allowed to load local resource: " + url)); | 932 frame->document()->addConsoleMessage(ConsoleMessage::create(SecurityMessageS ource, ErrorMessageLevel, "Not allowed to load local resource: " + url)); |
834 } | 933 } |
835 | 934 |
836 // static | |
837 ResourceRequest FrameLoader::requestFromHistoryItem(HistoryItem* item, ResourceR equestCachePolicy cachePolicy) | |
838 { | |
839 RefPtr<FormData> formData = item->formData(); | |
840 ResourceRequest request(item->url()); | |
841 request.setHTTPReferrer(item->referrer()); | |
842 request.setCachePolicy(cachePolicy); | |
843 if (formData) { | |
844 request.setHTTPMethod("POST"); | |
845 request.setHTTPBody(formData); | |
846 request.setHTTPContentType(item->formContentType()); | |
847 RefPtr<SecurityOrigin> securityOrigin = SecurityOrigin::createFromString (item->referrer().referrer); | |
848 request.addHTTPOriginIfNeeded(securityOrigin->toAtomicString()); | |
849 } | |
850 return request; | |
851 } | |
852 | |
853 void FrameLoader::reload(ReloadPolicy reloadPolicy, const KURL& overrideURL, Cli entRedirectPolicy clientRedirectPolicy) | |
854 { | |
855 if (!m_currentItem) | |
856 return; | |
857 | |
858 ResourceRequestCachePolicy cachePolicy = reloadPolicy == EndToEndReload ? Re loadBypassingCache : ReloadIgnoringCacheData; | |
859 ResourceRequest request = requestFromHistoryItem(m_currentItem.get(), cacheP olicy); | |
860 | |
861 // ClientRedirectPolicy is an indication that this load was triggered by | |
862 // some direct interaction with the page. If this reload is not a client | |
863 // redirect, we should reuse the referrer from the original load of the | |
864 // current document. If this reload is a client redirect (e.g., location.rel oad()), | |
865 // it was initiated by something in the current document and should | |
866 // therefore show the current document's url as the referrer. | |
867 if (clientRedirectPolicy == ClientRedirect) | |
868 request.setHTTPReferrer(Referrer(m_frame->document()->outgoingReferrer() , m_frame->document()->referrerPolicy())); | |
869 | |
870 if (!overrideURL.isEmpty()) { | |
871 request.setURL(overrideURL); | |
872 request.clearHTTPReferrer(); | |
873 } | |
874 request.setSkipServiceWorker(reloadPolicy == EndToEndReload); | |
875 FrameLoadRequest frameLoadRequest(nullptr, request); | |
876 frameLoadRequest.setClientRedirect(clientRedirectPolicy); | |
877 startLoad(frameLoadRequest, reloadPolicy == EndToEndReload ? FrameLoadTypeRe loadFromOrigin : FrameLoadTypeReload, NavigationPolicyCurrentTab); | |
878 } | |
879 | |
880 void FrameLoader::stopAllLoaders() | 935 void FrameLoader::stopAllLoaders() |
881 { | 936 { |
882 if (m_frame->document()->pageDismissalEventBeingDispatched() != Document::No Dismissal) | 937 if (m_frame->document()->pageDismissalEventBeingDispatched() != Document::No Dismissal) |
883 return; | 938 return; |
884 | 939 |
885 // If this method is called from within this method, infinite recursion can occur (3442218). Avoid this. | 940 // If this method is called from within this method, infinite recursion can occur (3442218). Avoid this. |
886 if (m_inStopAllLoaders) | 941 if (m_inStopAllLoaders) |
887 return; | 942 return; |
888 | 943 |
889 // Calling stopLoading() on the provisional document loader can blow away | 944 // Calling stopLoading() on the provisional document loader can blow away |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1118 if (!m_provisionalDocumentLoader && m_frame->isLoading()) { | 1173 if (!m_provisionalDocumentLoader && m_frame->isLoading()) { |
1119 client()->dispatchDidFailLoad(error, historyCommitType); | 1174 client()->dispatchDidFailLoad(error, historyCommitType); |
1120 m_progressTracker->progressCompleted(); | 1175 m_progressTracker->progressCompleted(); |
1121 } | 1176 } |
1122 } | 1177 } |
1123 checkCompleted(); | 1178 checkCompleted(); |
1124 } | 1179 } |
1125 | 1180 |
1126 bool FrameLoader::shouldPerformFragmentNavigation(bool isFormSubmission, const S tring& httpMethod, FrameLoadType loadType, const KURL& url) | 1181 bool FrameLoader::shouldPerformFragmentNavigation(bool isFormSubmission, const S tring& httpMethod, FrameLoadType loadType, const KURL& url) |
1127 { | 1182 { |
1128 ASSERT(loadType != FrameLoadTypeReloadFromOrigin); | |
1129 // We don't do this if we are submitting a form with method other than "GET" , explicitly reloading, | 1183 // We don't do this if we are submitting a form with method other than "GET" , explicitly reloading, |
1130 // currently displaying a frameset, or if the URL does not have a fragment. | 1184 // currently displaying a frameset, or if the URL does not have a fragment. |
1131 return (!isFormSubmission || equalIgnoringCase(httpMethod, "GET")) | 1185 return (!isFormSubmission || equalIgnoringCase(httpMethod, "GET")) |
1132 && loadType != FrameLoadTypeReload | 1186 && loadType != FrameLoadTypeReload |
1187 && loadType != FrameLoadTypeReloadFromOrigin | |
1133 && loadType != FrameLoadTypeSame | 1188 && loadType != FrameLoadTypeSame |
1134 && loadType != FrameLoadTypeBackForward | 1189 && loadType != FrameLoadTypeBackForward |
1135 && url.hasFragmentIdentifier() | 1190 && url.hasFragmentIdentifier() |
1136 && equalIgnoringFragmentIdentifier(m_frame->document()->url(), url) | 1191 && equalIgnoringFragmentIdentifier(m_frame->document()->url(), url) |
1137 // We don't want to just scroll if a link from within a | 1192 // We don't want to just scroll if a link from within a |
1138 // frameset is trying to reload the frameset into _top. | 1193 // frameset is trying to reload the frameset into _top. |
1139 && !m_frame->document()->isFrameSet(); | 1194 && !m_frame->document()->isFrameSet(); |
1140 } | 1195 } |
1141 | 1196 |
1142 void FrameLoader::scrollToFragmentWithParentBoundary(const KURL& url) | 1197 void FrameLoader::scrollToFragmentWithParentBoundary(const KURL& url) |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1328 bool FrameLoader::shouldTreatURLAsSrcdocDocument(const KURL& url) const | 1383 bool FrameLoader::shouldTreatURLAsSrcdocDocument(const KURL& url) const |
1329 { | 1384 { |
1330 if (!equalIgnoringCase(url.string(), "about:srcdoc")) | 1385 if (!equalIgnoringCase(url.string(), "about:srcdoc")) |
1331 return false; | 1386 return false; |
1332 HTMLFrameOwnerElement* ownerElement = m_frame->deprecatedLocalOwner(); | 1387 HTMLFrameOwnerElement* ownerElement = m_frame->deprecatedLocalOwner(); |
1333 if (!isHTMLIFrameElement(ownerElement)) | 1388 if (!isHTMLIFrameElement(ownerElement)) |
1334 return false; | 1389 return false; |
1335 return ownerElement->fastHasAttribute(srcdocAttr); | 1390 return ownerElement->fastHasAttribute(srcdocAttr); |
1336 } | 1391 } |
1337 | 1392 |
1338 void FrameLoader::loadHistoryItem(HistoryItem* item, FrameLoadType frameLoadType , HistoryLoadType historyLoadType, ResourceRequestCachePolicy cachePolicy) | |
1339 { | |
1340 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); | |
1341 if (m_frame->page()->defersLoading()) { | |
1342 m_deferredHistoryLoad = DeferredHistoryLoad(item, historyLoadType, cache Policy); | |
1343 return; | |
1344 } | |
1345 | |
1346 m_provisionalItem = item; | |
1347 if (historyLoadType == HistorySameDocumentLoad) { | |
1348 loadInSameDocument(item->url(), item->stateObject(), frameLoadType, NotC lientRedirect); | |
1349 restoreScrollPositionAndViewState(); | |
1350 return; | |
1351 } | |
1352 FrameLoadRequest request(nullptr, requestFromHistoryItem(item, cachePolicy)) ; | |
1353 startLoad(request, frameLoadType, NavigationPolicyCurrentTab); | |
1354 } | |
1355 | |
1356 void FrameLoader::dispatchDocumentElementAvailable() | 1393 void FrameLoader::dispatchDocumentElementAvailable() |
1357 { | 1394 { |
1358 client()->documentElementAvailable(); | 1395 client()->documentElementAvailable(); |
1359 } | 1396 } |
1360 | 1397 |
1361 void FrameLoader::dispatchDidClearDocumentOfWindowObject() | 1398 void FrameLoader::dispatchDidClearDocumentOfWindowObject() |
1362 { | 1399 { |
1363 if (!m_frame->script().canExecuteScripts(NotAboutToExecuteScript)) | 1400 if (!m_frame->script().canExecuteScripts(NotAboutToExecuteScript)) |
1364 return; | 1401 return; |
1365 | 1402 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1433 // 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 |
1434 // 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. |
1435 if (!parentFrame->isLocalFrame()) | 1472 if (!parentFrame->isLocalFrame()) |
1436 return nullptr; | 1473 return nullptr; |
1437 | 1474 |
1438 ASSERT(toLocalFrame(parentFrame)->document()); | 1475 ASSERT(toLocalFrame(parentFrame)->document()); |
1439 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade() ; | 1476 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade() ; |
1440 } | 1477 } |
1441 | 1478 |
1442 } // namespace blink | 1479 } // namespace blink |
OLD | NEW |