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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 , m_dispatchingDidClearWindowObjectInMainWorld(false) | 182 , m_dispatchingDidClearWindowObjectInMainWorld(false) |
183 , m_protectProvisionalLoader(false) | 183 , m_protectProvisionalLoader(false) |
184 { | 184 { |
185 TRACE_EVENT_OBJECT_CREATED_WITH_ID("loading", "FrameLoader", this); | 185 TRACE_EVENT_OBJECT_CREATED_WITH_ID("loading", "FrameLoader", this); |
186 takeObjectSnapshot(); | 186 takeObjectSnapshot(); |
187 } | 187 } |
188 | 188 |
189 FrameLoader::~FrameLoader() | 189 FrameLoader::~FrameLoader() |
190 { | 190 { |
191 // Verify that this FrameLoader has been detached. | 191 // Verify that this FrameLoader has been detached. |
192 ASSERT(!m_progressTracker); | 192 DCHECK(!m_progressTracker); |
193 } | 193 } |
194 | 194 |
195 DEFINE_TRACE(FrameLoader) | 195 DEFINE_TRACE(FrameLoader) |
196 { | 196 { |
197 visitor->trace(m_frame); | 197 visitor->trace(m_frame); |
198 visitor->trace(m_progressTracker); | 198 visitor->trace(m_progressTracker); |
199 visitor->trace(m_documentLoader); | 199 visitor->trace(m_documentLoader); |
200 visitor->trace(m_provisionalDocumentLoader); | 200 visitor->trace(m_provisionalDocumentLoader); |
201 visitor->trace(m_currentItem); | 201 visitor->trace(m_currentItem); |
202 visitor->trace(m_provisionalItem); | 202 visitor->trace(m_provisionalItem); |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 TRACE_EVENT1("devtools.timeline", "CommitLoad", "data", InspectorCommitLoadE
vent::data(m_frame)); | 460 TRACE_EVENT1("devtools.timeline", "CommitLoad", "data", InspectorCommitLoadE
vent::data(m_frame)); |
461 InspectorInstrumentation::didCommitLoad(m_frame, m_documentLoader.get()); | 461 InspectorInstrumentation::didCommitLoad(m_frame, m_documentLoader.get()); |
462 m_frame->page()->didCommitLoad(m_frame); | 462 m_frame->page()->didCommitLoad(m_frame); |
463 dispatchDidClearDocumentOfWindowObject(); | 463 dispatchDidClearDocumentOfWindowObject(); |
464 | 464 |
465 takeObjectSnapshot(); | 465 takeObjectSnapshot(); |
466 } | 466 } |
467 | 467 |
468 void FrameLoader::didInstallNewDocument(bool dispatchWindowObjectAvailable) | 468 void FrameLoader::didInstallNewDocument(bool dispatchWindowObjectAvailable) |
469 { | 469 { |
470 ASSERT(m_frame); | 470 DCHECK(m_frame); |
471 ASSERT(m_frame->document()); | 471 DCHECK(m_frame->document()); |
472 | 472 |
473 m_frame->document()->setReadyState(Document::Loading); | 473 m_frame->document()->setReadyState(Document::Loading); |
474 | 474 |
475 if (dispatchWindowObjectAvailable) | 475 if (dispatchWindowObjectAvailable) |
476 dispatchDidClearDocumentOfWindowObject(); | 476 dispatchDidClearDocumentOfWindowObject(); |
477 | 477 |
478 m_frame->document()->initContentSecurityPolicy(m_documentLoader ? m_document
Loader->releaseContentSecurityPolicy() : ContentSecurityPolicy::create()); | 478 m_frame->document()->initContentSecurityPolicy(m_documentLoader ? m_document
Loader->releaseContentSecurityPolicy() : ContentSecurityPolicy::create()); |
479 | 479 |
480 if (m_provisionalItem && isBackForwardLoadType(m_loadType)) | 480 if (m_provisionalItem && isBackForwardLoadType(m_loadType)) |
481 m_frame->document()->setStateForNewFormElements(m_provisionalItem->docum
entState()); | 481 m_frame->document()->setStateForNewFormElements(m_provisionalItem->docum
entState()); |
482 } | 482 } |
483 | 483 |
484 void FrameLoader::didBeginDocument() | 484 void FrameLoader::didBeginDocument() |
485 { | 485 { |
486 ASSERT(m_frame); | 486 DCHECK(m_frame); |
487 ASSERT(m_frame->document()); | 487 DCHECK(m_frame->document()); |
488 ASSERT(m_frame->document()->fetcher()); | 488 DCHECK(m_frame->document()->fetcher()); |
489 | 489 |
490 if (m_documentLoader) { | 490 if (m_documentLoader) { |
491 String suboriginHeader = m_documentLoader->response().httpHeaderField(HT
TPNames::Suborigin); | 491 String suboriginHeader = m_documentLoader->response().httpHeaderField(HT
TPNames::Suborigin); |
492 if (!suboriginHeader.isNull()) { | 492 if (!suboriginHeader.isNull()) { |
493 Vector<String> messages; | 493 Vector<String> messages; |
494 Suborigin suborigin; | 494 Suborigin suborigin; |
495 if (parseSuboriginHeader(suboriginHeader, &suborigin, messages)) | 495 if (parseSuboriginHeader(suboriginHeader, &suborigin, messages)) |
496 m_frame->document()->enforceSuborigin(suborigin); | 496 m_frame->document()->enforceSuborigin(suborigin); |
497 | 497 |
498 for (auto& message : messages) | 498 for (auto& message : messages) |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 return; | 743 return; |
744 | 744 |
745 FrameNavigationDisabler navigationDisabler(*m_frame); | 745 FrameNavigationDisabler navigationDisabler(*m_frame); |
746 loader->detachFromFrame(); | 746 loader->detachFromFrame(); |
747 loader = nullptr; | 747 loader = nullptr; |
748 } | 748 } |
749 | 749 |
750 void FrameLoader::loadInSameDocument(const KURL& url, PassRefPtr<SerializedScrip
tValue> stateObject, FrameLoadType frameLoadType, HistoryLoadType historyLoadTyp
e, ClientRedirectPolicy clientRedirect, Document* initiatingDocument) | 750 void FrameLoader::loadInSameDocument(const KURL& url, PassRefPtr<SerializedScrip
tValue> stateObject, FrameLoadType frameLoadType, HistoryLoadType historyLoadTyp
e, ClientRedirectPolicy clientRedirect, Document* initiatingDocument) |
751 { | 751 { |
752 // If we have a state object, we cannot also be a new navigation. | 752 // If we have a state object, we cannot also be a new navigation. |
753 ASSERT(!stateObject || frameLoadType == FrameLoadTypeBackForward); | 753 DCHECK(!stateObject || frameLoadType == FrameLoadTypeBackForward); |
754 | 754 |
755 // If we have a provisional request for a different document, a fragment scr
oll should cancel it. | 755 // If we have a provisional request for a different document, a fragment scr
oll should cancel it. |
756 detachDocumentLoader(m_provisionalDocumentLoader); | 756 detachDocumentLoader(m_provisionalDocumentLoader); |
757 if (!m_frame->host()) | 757 if (!m_frame->host()) |
758 return; | 758 return; |
759 AutoReset<FrameLoadType> loadTypeChange(&m_loadType, frameLoadType); | 759 AutoReset<FrameLoadType> loadTypeChange(&m_loadType, frameLoadType); |
760 saveScrollState(); | 760 saveScrollState(); |
761 | 761 |
762 KURL oldURL = m_frame->document()->url(); | 762 KURL oldURL = m_frame->document()->url(); |
763 bool hashChange = equalIgnoringFragmentIdentifier(url, oldURL) && url.fragme
ntIdentifier() != oldURL.fragmentIdentifier(); | 763 bool hashChange = equalIgnoringFragmentIdentifier(url, oldURL) && url.fragme
ntIdentifier() != oldURL.fragmentIdentifier(); |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
927 // The click is simulated when triggering the gesture-tap event | 927 // The click is simulated when triggering the gesture-tap event |
928 GestureEvent* gestureEvent = toGestureEvent(event); | 928 GestureEvent* gestureEvent = toGestureEvent(event); |
929 navigationPolicyFromMouseEvent(0, gestureEvent->ctrlKey(), gestureEvent-
>shiftKey(), gestureEvent->altKey(), gestureEvent->metaKey(), &policy); | 929 navigationPolicyFromMouseEvent(0, gestureEvent->ctrlKey(), gestureEvent-
>shiftKey(), gestureEvent->altKey(), gestureEvent->metaKey(), &policy); |
930 } | 930 } |
931 return policy; | 931 return policy; |
932 } | 932 } |
933 | 933 |
934 void FrameLoader::load(const FrameLoadRequest& passedRequest, FrameLoadType fram
eLoadType, | 934 void FrameLoader::load(const FrameLoadRequest& passedRequest, FrameLoadType fram
eLoadType, |
935 HistoryItem* historyItem, HistoryLoadType historyLoadType) | 935 HistoryItem* historyItem, HistoryLoadType historyLoadType) |
936 { | 936 { |
937 ASSERT(m_frame->document()); | 937 DCHECK(m_frame->document()); |
938 | 938 |
939 if (!m_frame->isNavigationAllowed()) | 939 if (!m_frame->isNavigationAllowed()) |
940 return; | 940 return; |
941 | 941 |
942 if (m_inStopAllLoaders) | 942 if (m_inStopAllLoaders) |
943 return; | 943 return; |
944 | 944 |
945 if (m_frame->page()->defersLoading() && isBackForwardLoadType(frameLoadType)
) { | 945 if (m_frame->page()->defersLoading() && isBackForwardLoadType(frameLoadType)
) { |
946 m_deferredHistoryLoad = DeferredHistoryLoad::create(passedRequest.resour
ceRequest(), historyItem, frameLoadType, historyLoadType); | 946 m_deferredHistoryLoad = DeferredHistoryLoad::create(passedRequest.resour
ceRequest(), historyItem, frameLoadType, historyLoadType); |
947 return; | 947 return; |
948 } | 948 } |
949 | 949 |
950 FrameLoadRequest request(passedRequest); | 950 FrameLoadRequest request(passedRequest); |
951 request.resourceRequest().setHasUserGesture(UserGestureIndicator::processing
UserGesture()); | 951 request.resourceRequest().setHasUserGesture(UserGestureIndicator::processing
UserGesture()); |
952 | 952 |
953 if (!prepareRequestForThisFrame(request)) | 953 if (!prepareRequestForThisFrame(request)) |
954 return; | 954 return; |
955 | 955 |
956 Frame* targetFrame = request.form() ? nullptr : m_frame->findFrameForNavigat
ion(AtomicString(request.frameName()), *m_frame); | 956 Frame* targetFrame = request.form() ? nullptr : m_frame->findFrameForNavigat
ion(AtomicString(request.frameName()), *m_frame); |
957 | 957 |
958 if (isBackForwardLoadType(frameLoadType)) { | 958 if (isBackForwardLoadType(frameLoadType)) { |
959 ASSERT(historyItem); | 959 DCHECK(historyItem); |
960 m_provisionalItem = historyItem; | 960 m_provisionalItem = historyItem; |
961 } | 961 } |
962 | 962 |
963 if (targetFrame && targetFrame != m_frame) { | 963 if (targetFrame && targetFrame != m_frame) { |
964 bool wasInSamePage = targetFrame->page() == m_frame->page(); | 964 bool wasInSamePage = targetFrame->page() == m_frame->page(); |
965 | 965 |
966 request.setFrameName("_self"); | 966 request.setFrameName("_self"); |
967 targetFrame->navigate(request); | 967 targetFrame->navigate(request); |
968 Page* page = targetFrame->page(); | 968 Page* page = targetFrame->page(); |
969 if (!wasInSamePage && page) | 969 if (!wasInSamePage && page) |
(...skipping 18 matching lines...) Expand all Loading... |
988 | 988 |
989 const KURL& url = request.resourceRequest().url(); | 989 const KURL& url = request.resourceRequest().url(); |
990 bool sameDocumentHistoryNavigation = | 990 bool sameDocumentHistoryNavigation = |
991 isBackForwardLoadType(newLoadType) && historyLoadType == HistorySameDocu
mentLoad; | 991 isBackForwardLoadType(newLoadType) && historyLoadType == HistorySameDocu
mentLoad; |
992 bool sameDocumentNavigation = policy == NavigationPolicyCurrentTab | 992 bool sameDocumentNavigation = policy == NavigationPolicyCurrentTab |
993 && shouldPerformFragmentNavigation( | 993 && shouldPerformFragmentNavigation( |
994 request.form(), request.resourceRequest().httpMethod(), newLoadType,
url); | 994 request.form(), request.resourceRequest().httpMethod(), newLoadType,
url); |
995 | 995 |
996 // Perform same document navigation. | 996 // Perform same document navigation. |
997 if (sameDocumentHistoryNavigation || sameDocumentNavigation) { | 997 if (sameDocumentHistoryNavigation || sameDocumentNavigation) { |
998 ASSERT(historyItem || !sameDocumentHistoryNavigation); | 998 DCHECK(historyItem || !sameDocumentHistoryNavigation); |
999 RefPtr<SerializedScriptValue> stateObject = sameDocumentHistoryNavigatio
n ? | 999 RefPtr<SerializedScriptValue> stateObject = sameDocumentHistoryNavigatio
n ? |
1000 historyItem->stateObject() : nullptr; | 1000 historyItem->stateObject() : nullptr; |
1001 | 1001 |
1002 if (!sameDocumentHistoryNavigation) { | 1002 if (!sameDocumentHistoryNavigation) { |
1003 m_documentLoader->setNavigationType(determineNavigationType( | 1003 m_documentLoader->setNavigationType(determineNavigationType( |
1004 newLoadType, false, request.triggeringEvent())); | 1004 newLoadType, false, request.triggeringEvent())); |
1005 if (shouldTreatURLAsSameAsCurrent(url)) | 1005 if (shouldTreatURLAsSameAsCurrent(url)) |
1006 newLoadType = FrameLoadTypeReplaceCurrentItem; | 1006 newLoadType = FrameLoadTypeReplaceCurrentItem; |
1007 } | 1007 } |
1008 | 1008 |
1009 loadInSameDocument(url, stateObject, newLoadType, historyLoadType, reque
st.clientRedirect(), request.originDocument()); | 1009 loadInSameDocument(url, stateObject, newLoadType, historyLoadType, reque
st.clientRedirect(), request.originDocument()); |
1010 return; | 1010 return; |
1011 } | 1011 } |
1012 | 1012 |
1013 startLoad(request, newLoadType, policy); | 1013 startLoad(request, newLoadType, policy); |
1014 } | 1014 } |
1015 | 1015 |
1016 SubstituteData FrameLoader::defaultSubstituteDataForURL(const KURL& url) | 1016 SubstituteData FrameLoader::defaultSubstituteDataForURL(const KURL& url) |
1017 { | 1017 { |
1018 if (!shouldTreatURLAsSrcdocDocument(url)) | 1018 if (!shouldTreatURLAsSrcdocDocument(url)) |
1019 return SubstituteData(); | 1019 return SubstituteData(); |
1020 String srcdoc = m_frame->deprecatedLocalOwner()->fastGetAttribute(srcdocAttr
); | 1020 String srcdoc = m_frame->deprecatedLocalOwner()->fastGetAttribute(srcdocAttr
); |
1021 ASSERT(!srcdoc.isNull()); | 1021 DCHECK(!srcdoc.isNull()); |
1022 CString encodedSrcdoc = srcdoc.utf8(); | 1022 CString encodedSrcdoc = srcdoc.utf8(); |
1023 return SubstituteData(SharedBuffer::create(encodedSrcdoc.data(), encodedSrcd
oc.length()), "text/html", "UTF-8", KURL()); | 1023 return SubstituteData(SharedBuffer::create(encodedSrcdoc.data(), encodedSrcd
oc.length()), "text/html", "UTF-8", KURL()); |
1024 } | 1024 } |
1025 | 1025 |
1026 void FrameLoader::reportLocalLoadFailed(LocalFrame* frame, const String& url) | 1026 void FrameLoader::reportLocalLoadFailed(LocalFrame* frame, const String& url) |
1027 { | 1027 { |
1028 ASSERT(!url.isEmpty()); | 1028 DCHECK(!url.isEmpty()); |
1029 if (!frame) | 1029 if (!frame) |
1030 return; | 1030 return; |
1031 | 1031 |
1032 frame->document()->addConsoleMessage(ConsoleMessage::create(SecurityMessageS
ource, ErrorMessageLevel, "Not allowed to load local resource: " + url)); | 1032 frame->document()->addConsoleMessage(ConsoleMessage::create(SecurityMessageS
ource, ErrorMessageLevel, "Not allowed to load local resource: " + url)); |
1033 } | 1033 } |
1034 | 1034 |
1035 void FrameLoader::stopAllLoaders() | 1035 void FrameLoader::stopAllLoaders() |
1036 { | 1036 { |
1037 if (m_frame->document()->pageDismissalEventBeingDispatched() != Document::No
Dismissal) | 1037 if (m_frame->document()->pageDismissalEventBeingDispatched() != Document::No
Dismissal) |
1038 return; | 1038 return; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1118 // window.stop(), which will in turn detach the provisional document loader. | 1118 // window.stop(), which will in turn detach the provisional document loader. |
1119 // At this point, the provisional document loader should not detach, because | 1119 // At this point, the provisional document loader should not detach, because |
1120 // then the FrameLoader would not have any attached DocumentLoaders. | 1120 // then the FrameLoader would not have any attached DocumentLoaders. |
1121 if (m_documentLoader) { | 1121 if (m_documentLoader) { |
1122 AutoReset<bool> inDetachDocumentLoader(&m_protectProvisionalLoader, true
); | 1122 AutoReset<bool> inDetachDocumentLoader(&m_protectProvisionalLoader, true
); |
1123 detachDocumentLoader(m_documentLoader); | 1123 detachDocumentLoader(m_documentLoader); |
1124 } | 1124 } |
1125 // 'abort' listeners can also detach the frame. | 1125 // 'abort' listeners can also detach the frame. |
1126 if (!m_frame->client()) | 1126 if (!m_frame->client()) |
1127 return false; | 1127 return false; |
1128 ASSERT(m_provisionalDocumentLoader == pdl); | 1128 DCHECK_EQ(m_provisionalDocumentLoader, pdl); |
1129 // No more events will be dispatched so detach the Document. | 1129 // No more events will be dispatched so detach the Document. |
1130 // TODO(yoav): Should we also be nullifying domWindow's document (or domWind
ow) since the doc is now detached? | 1130 // TODO(yoav): Should we also be nullifying domWindow's document (or domWind
ow) since the doc is now detached? |
1131 if (m_frame->document()) | 1131 if (m_frame->document()) |
1132 m_frame->document()->shutdown(); | 1132 m_frame->document()->shutdown(); |
1133 m_documentLoader = m_provisionalDocumentLoader.release(); | 1133 m_documentLoader = m_provisionalDocumentLoader.release(); |
1134 takeObjectSnapshot(); | 1134 takeObjectSnapshot(); |
1135 | 1135 |
1136 return true; | 1136 return true; |
1137 } | 1137 } |
1138 | 1138 |
1139 void FrameLoader::commitProvisionalLoad() | 1139 void FrameLoader::commitProvisionalLoad() |
1140 { | 1140 { |
1141 ASSERT(client()->hasWebView()); | 1141 DCHECK(client()->hasWebView()); |
1142 | 1142 |
1143 // Check if the destination page is allowed to access the previous page's ti
ming information. | 1143 // Check if the destination page is allowed to access the previous page's ti
ming information. |
1144 if (m_frame->document()) { | 1144 if (m_frame->document()) { |
1145 RefPtr<SecurityOrigin> securityOrigin = SecurityOrigin::create(m_provisi
onalDocumentLoader->request().url()); | 1145 RefPtr<SecurityOrigin> securityOrigin = SecurityOrigin::create(m_provisi
onalDocumentLoader->request().url()); |
1146 m_provisionalDocumentLoader->timing().setHasSameOriginAsPreviousDocument
(securityOrigin->canRequest(m_frame->document()->url())); | 1146 m_provisionalDocumentLoader->timing().setHasSameOriginAsPreviousDocument
(securityOrigin->canRequest(m_frame->document()->url())); |
1147 } | 1147 } |
1148 | 1148 |
1149 if (!prepareForCommit()) | 1149 if (!prepareForCommit()) |
1150 return; | 1150 return; |
1151 | 1151 |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1271 } | 1271 } |
1272 | 1272 |
1273 HistoryCommitType historyCommitType = loadTypeToCommitType(m_loadType); | 1273 HistoryCommitType historyCommitType = loadTypeToCommitType(m_loadType); |
1274 if (loader == m_provisionalDocumentLoader) { | 1274 if (loader == m_provisionalDocumentLoader) { |
1275 client()->dispatchDidFailProvisionalLoad(error, historyCommitType); | 1275 client()->dispatchDidFailProvisionalLoad(error, historyCommitType); |
1276 if (loader != m_provisionalDocumentLoader) | 1276 if (loader != m_provisionalDocumentLoader) |
1277 return; | 1277 return; |
1278 detachDocumentLoader(m_provisionalDocumentLoader); | 1278 detachDocumentLoader(m_provisionalDocumentLoader); |
1279 m_progressTracker->progressCompleted(); | 1279 m_progressTracker->progressCompleted(); |
1280 } else { | 1280 } else { |
1281 ASSERT(loader == m_documentLoader); | 1281 DCHECK_EQ(loader, m_documentLoader); |
1282 if (m_frame->document()->parser()) | 1282 if (m_frame->document()->parser()) |
1283 m_frame->document()->parser()->stopParsing(); | 1283 m_frame->document()->parser()->stopParsing(); |
1284 m_documentLoader->setSentDidFinishLoad(); | 1284 m_documentLoader->setSentDidFinishLoad(); |
1285 if (!m_provisionalDocumentLoader && m_frame->isLoading()) { | 1285 if (!m_provisionalDocumentLoader && m_frame->isLoading()) { |
1286 client()->dispatchDidFailLoad(error, historyCommitType); | 1286 client()->dispatchDidFailLoad(error, historyCommitType); |
1287 m_progressTracker->progressCompleted(); | 1287 m_progressTracker->progressCompleted(); |
1288 } | 1288 } |
1289 } | 1289 } |
1290 checkCompleted(); | 1290 checkCompleted(); |
1291 } | 1291 } |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1404 return false; | 1404 return false; |
1405 } | 1405 } |
1406 if (!LocalDOMWindow::allowPopUp(*m_frame) && !UserGestureIndicator::utilizeU
serGesture()) | 1406 if (!LocalDOMWindow::allowPopUp(*m_frame) && !UserGestureIndicator::utilizeU
serGesture()) |
1407 return false; | 1407 return false; |
1408 client()->loadURLExternally(request, policy, String(), replacesCurrentHistor
yItem); | 1408 client()->loadURLExternally(request, policy, String(), replacesCurrentHistor
yItem); |
1409 return false; | 1409 return false; |
1410 } | 1410 } |
1411 | 1411 |
1412 void FrameLoader::startLoad(FrameLoadRequest& frameLoadRequest, FrameLoadType ty
pe, NavigationPolicy navigationPolicy) | 1412 void FrameLoader::startLoad(FrameLoadRequest& frameLoadRequest, FrameLoadType ty
pe, NavigationPolicy navigationPolicy) |
1413 { | 1413 { |
1414 ASSERT(client()->hasWebView()); | 1414 DCHECK(client()->hasWebView()); |
1415 if (m_frame->document()->pageDismissalEventBeingDispatched() != Document::No
Dismissal) | 1415 if (m_frame->document()->pageDismissalEventBeingDispatched() != Document::No
Dismissal) |
1416 return; | 1416 return; |
1417 | 1417 |
1418 NavigationType navigationType = determineNavigationType(type, frameLoadReque
st.resourceRequest().httpBody() || frameLoadRequest.form(), frameLoadRequest.tri
ggeringEvent()); | 1418 NavigationType navigationType = determineNavigationType(type, frameLoadReque
st.resourceRequest().httpBody() || frameLoadRequest.form(), frameLoadRequest.tri
ggeringEvent()); |
1419 frameLoadRequest.resourceRequest().setRequestContext(determineRequestContext
FromNavigationType(navigationType)); | 1419 frameLoadRequest.resourceRequest().setRequestContext(determineRequestContext
FromNavigationType(navigationType)); |
1420 frameLoadRequest.resourceRequest().setFrameType(m_frame->isMainFrame() ? Web
URLRequest::FrameTypeTopLevel : WebURLRequest::FrameTypeNested); | 1420 frameLoadRequest.resourceRequest().setFrameType(m_frame->isMainFrame() ? Web
URLRequest::FrameTypeTopLevel : WebURLRequest::FrameTypeNested); |
1421 ResourceRequest& request = frameLoadRequest.resourceRequest(); | 1421 ResourceRequest& request = frameLoadRequest.resourceRequest(); |
1422 upgradeInsecureRequest(request, nullptr); | 1422 upgradeInsecureRequest(request, nullptr); |
1423 if (!shouldContinueForNavigationPolicy(request, frameLoadRequest.substituteD
ata(), nullptr, frameLoadRequest.shouldCheckMainWorldContentSecurityPolicy(), na
vigationType, navigationPolicy, type == FrameLoadTypeReplaceCurrentItem, frameLo
adRequest.clientRedirect() == ClientRedirectPolicy::ClientRedirect)) | 1423 if (!shouldContinueForNavigationPolicy(request, frameLoadRequest.substituteD
ata(), nullptr, frameLoadRequest.shouldCheckMainWorldContentSecurityPolicy(), na
vigationType, navigationPolicy, type == FrameLoadTypeReplaceCurrentItem, frameLo
adRequest.clientRedirect() == ClientRedirectPolicy::ClientRedirect)) |
1424 return; | 1424 return; |
(...skipping 18 matching lines...) Expand all Loading... |
1443 | 1443 |
1444 if (frameLoadRequest.form()) | 1444 if (frameLoadRequest.form()) |
1445 client()->dispatchWillSubmitForm(frameLoadRequest.form()); | 1445 client()->dispatchWillSubmitForm(frameLoadRequest.form()); |
1446 | 1446 |
1447 m_progressTracker->progressStarted(); | 1447 m_progressTracker->progressStarted(); |
1448 if (m_provisionalDocumentLoader->isClientRedirect()) | 1448 if (m_provisionalDocumentLoader->isClientRedirect()) |
1449 m_provisionalDocumentLoader->appendRedirect(m_frame->document()->url()); | 1449 m_provisionalDocumentLoader->appendRedirect(m_frame->document()->url()); |
1450 m_provisionalDocumentLoader->appendRedirect(m_provisionalDocumentLoader->req
uest().url()); | 1450 m_provisionalDocumentLoader->appendRedirect(m_provisionalDocumentLoader->req
uest().url()); |
1451 double triggeringEventTime = frameLoadRequest.triggeringEvent() ? frameLoadR
equest.triggeringEvent()->platformTimeStamp() : 0; | 1451 double triggeringEventTime = frameLoadRequest.triggeringEvent() ? frameLoadR
equest.triggeringEvent()->platformTimeStamp() : 0; |
1452 client()->dispatchDidStartProvisionalLoad(triggeringEventTime); | 1452 client()->dispatchDidStartProvisionalLoad(triggeringEventTime); |
1453 ASSERT(m_provisionalDocumentLoader); | 1453 DCHECK(m_provisionalDocumentLoader); |
1454 m_provisionalDocumentLoader->startLoadingMainResource(); | 1454 m_provisionalDocumentLoader->startLoadingMainResource(); |
1455 | 1455 |
1456 takeObjectSnapshot(); | 1456 takeObjectSnapshot(); |
1457 } | 1457 } |
1458 | 1458 |
1459 void FrameLoader::applyUserAgent(ResourceRequest& request) | 1459 void FrameLoader::applyUserAgent(ResourceRequest& request) |
1460 { | 1460 { |
1461 String userAgent = this->userAgent(); | 1461 String userAgent = this->userAgent(); |
1462 ASSERT(!userAgent.isNull()); | 1462 DCHECK(!userAgent.isNull()); |
1463 request.setHTTPUserAgent(AtomicString(userAgent)); | 1463 request.setHTTPUserAgent(AtomicString(userAgent)); |
1464 } | 1464 } |
1465 | 1465 |
1466 bool FrameLoader::shouldInterruptLoadForXFrameOptions(const String& content, con
st KURL& url, unsigned long requestIdentifier) | 1466 bool FrameLoader::shouldInterruptLoadForXFrameOptions(const String& content, con
st KURL& url, unsigned long requestIdentifier) |
1467 { | 1467 { |
1468 UseCounter::count(m_frame->domWindow()->document(), UseCounter::XFrameOption
s); | 1468 UseCounter::count(m_frame->domWindow()->document(), UseCounter::XFrameOption
s); |
1469 | 1469 |
1470 Frame* topFrame = m_frame->tree().top(); | 1470 Frame* topFrame = m_frame->tree().top(); |
1471 if (m_frame == topFrame) | 1471 if (m_frame == topFrame) |
1472 return false; | 1472 return false; |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1581 { | 1581 { |
1582 Frame* parentFrame = m_frame->tree().parent(); | 1582 Frame* parentFrame = m_frame->tree().parent(); |
1583 if (!parentFrame) | 1583 if (!parentFrame) |
1584 return kLeaveInsecureRequestsAlone; | 1584 return kLeaveInsecureRequestsAlone; |
1585 | 1585 |
1586 return parentFrame->securityContext()->getInsecureRequestPolicy(); | 1586 return parentFrame->securityContext()->getInsecureRequestPolicy(); |
1587 } | 1587 } |
1588 | 1588 |
1589 SecurityContext::InsecureNavigationsSet* FrameLoader::insecureNavigationsToUpgra
de() const | 1589 SecurityContext::InsecureNavigationsSet* FrameLoader::insecureNavigationsToUpgra
de() const |
1590 { | 1590 { |
1591 ASSERT(m_frame); | 1591 DCHECK(m_frame); |
1592 Frame* parentFrame = m_frame->tree().parent(); | 1592 Frame* parentFrame = m_frame->tree().parent(); |
1593 if (!parentFrame) | 1593 if (!parentFrame) |
1594 return nullptr; | 1594 return nullptr; |
1595 | 1595 |
1596 // FIXME: We need a way to propagate insecure requests policy flags to | 1596 // FIXME: We need a way to propagate insecure requests policy flags to |
1597 // out-of-process frames. For now, we'll always use default behavior. | 1597 // out-of-process frames. For now, we'll always use default behavior. |
1598 if (!parentFrame->isLocalFrame()) | 1598 if (!parentFrame->isLocalFrame()) |
1599 return nullptr; | 1599 return nullptr; |
1600 | 1600 |
1601 ASSERT(toLocalFrame(parentFrame)->document()); | 1601 DCHECK(toLocalFrame(parentFrame)->document()); |
1602 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade()
; | 1602 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade()
; |
1603 } | 1603 } |
1604 | 1604 |
1605 void FrameLoader::upgradeInsecureRequest(ResourceRequest& resourceRequest, Docum
ent* document) const | 1605 void FrameLoader::upgradeInsecureRequest(ResourceRequest& resourceRequest, Docum
ent* document) const |
1606 { | 1606 { |
1607 // Tack an 'Upgrade-Insecure-Requests' header to outgoing navigational reque
sts, as described in | 1607 // Tack an 'Upgrade-Insecure-Requests' header to outgoing navigational reque
sts, as described in |
1608 // https://w3c.github.io/webappsec/specs/upgrade/#feature-detect | 1608 // https://w3c.github.io/webappsec/specs/upgrade/#feature-detect |
1609 if (resourceRequest.frameType() != WebURLRequest::FrameTypeNone) { | 1609 if (resourceRequest.frameType() != WebURLRequest::FrameTypeNone) { |
1610 | 1610 |
1611 // Early return if the request has already been upgraded. | 1611 // Early return if the request has already been upgraded. |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1653 tracedValue->setString("documentLoaderURL", m_documentLoader ? m_documentLoa
der->url() : String()); | 1653 tracedValue->setString("documentLoaderURL", m_documentLoader ? m_documentLoa
der->url() : String()); |
1654 return tracedValue; | 1654 return tracedValue; |
1655 } | 1655 } |
1656 | 1656 |
1657 inline void FrameLoader::takeObjectSnapshot() const | 1657 inline void FrameLoader::takeObjectSnapshot() const |
1658 { | 1658 { |
1659 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, toTraced
Value()); | 1659 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, toTraced
Value()); |
1660 } | 1660 } |
1661 | 1661 |
1662 } // namespace blink | 1662 } // namespace blink |
OLD | NEW |