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