LEFT | RIGHT |
1 /* | 1 /* |
2 * Copyright (C) 2006-2016 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006-2016 Apple Inc. All rights reserved. |
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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 void FrameLoader::checkContentPolicy(const ResourceResponse& response, ContentPo
licyDecisionFunction&& function) | 363 void FrameLoader::checkContentPolicy(const ResourceResponse& response, ContentPo
licyDecisionFunction&& function) |
364 { | 364 { |
365 client().dispatchDecidePolicyForResponse(response, activeDocumentLoader()->r
equest(), WTFMove(function)); | 365 client().dispatchDecidePolicyForResponse(response, activeDocumentLoader()->r
equest(), WTFMove(function)); |
366 } | 366 } |
367 | 367 |
368 void FrameLoader::changeLocation(FrameLoadRequest&& request) | 368 void FrameLoader::changeLocation(FrameLoadRequest&& request) |
369 { | 369 { |
370 urlSelected(WTFMove(request), nullptr); | 370 urlSelected(WTFMove(request), nullptr); |
371 } | 371 } |
372 | 372 |
373 void FrameLoader::urlSelected(const URL& url, const String& passedTarget, Event*
triggeringEvent, LockHistory lockHistory, LockBackForwardList lockBackForwardLi
st, ShouldSendReferrer shouldSendReferrer, ShouldOpenExternalURLsPolicy shouldOp
enExternalURLsPolicy, std::optional<NewFrameOpenerPolicy> openerPolicy, const At
omicString& downloadAttribute) | 373 void FrameLoader::urlSelected(const URL& url, const String& passedTarget, Event*
triggeringEvent, LockHistory lockHistory, LockBackForwardList lockBackForwardLi
st, ShouldSendReferrer shouldSendReferrer, ShouldOpenExternalURLsPolicy shouldOp
enExternalURLsPolicy, std::optional<NewFrameOpenerPolicy> openerPolicy, const At
omicString& downloadAttribute, bool isSystemPreview) |
374 { | 374 { |
375 auto* frame = lexicalFrameFromCommonVM(); | 375 auto* frame = lexicalFrameFromCommonVM(); |
376 auto initiatedByMainFrame = frame && frame->isMainFrame() ? InitiatedByMainF
rame::Yes : InitiatedByMainFrame::Unknown; | 376 auto initiatedByMainFrame = frame && frame->isMainFrame() ? InitiatedByMainF
rame::Yes : InitiatedByMainFrame::Unknown; |
377 | 377 |
378 NewFrameOpenerPolicy newFrameOpenerPolicy = openerPolicy.value_or(shouldSend
Referrer == NeverSendReferrer ? NewFrameOpenerPolicy::Suppress : NewFrameOpenerP
olicy::Allow); | 378 NewFrameOpenerPolicy newFrameOpenerPolicy = openerPolicy.value_or(shouldSend
Referrer == NeverSendReferrer ? NewFrameOpenerPolicy::Suppress : NewFrameOpenerP
olicy::Allow); |
379 urlSelected(FrameLoadRequest(*m_frame.document(), m_frame.document()->securi
tyOrigin(), { url }, passedTarget, lockHistory, lockBackForwardList, shouldSendR
eferrer, AllowNavigationToInvalidURL::Yes, newFrameOpenerPolicy, shouldOpenExter
nalURLsPolicy, initiatedByMainFrame, DoNotReplaceDocumentIfJavaScriptURL, downlo
adAttribute), triggeringEvent); | 379 urlSelected(FrameLoadRequest(*m_frame.document(), m_frame.document()->securi
tyOrigin(), { url }, passedTarget, lockHistory, lockBackForwardList, shouldSendR
eferrer, AllowNavigationToInvalidURL::Yes, newFrameOpenerPolicy, shouldOpenExter
nalURLsPolicy, initiatedByMainFrame, DoNotReplaceDocumentIfJavaScriptURL, downlo
adAttribute, isSystemPreview), triggeringEvent); |
380 } | 380 } |
381 | 381 |
382 void FrameLoader::urlSelected(FrameLoadRequest&& frameRequest, Event* triggering
Event) | 382 void FrameLoader::urlSelected(FrameLoadRequest&& frameRequest, Event* triggering
Event) |
383 { | 383 { |
384 Ref<Frame> protect(m_frame); | 384 Ref<Frame> protect(m_frame); |
385 | 385 |
386 if (m_frame.script().executeIfJavaScriptURL(frameRequest.resourceRequest().u
rl(), frameRequest.shouldReplaceDocumentIfJavaScriptURL())) | 386 if (m_frame.script().executeIfJavaScriptURL(frameRequest.resourceRequest().u
rl(), frameRequest.shouldReplaceDocumentIfJavaScriptURL())) |
387 return; | 387 return; |
388 | 388 |
389 if (frameRequest.frameName().isEmpty()) | 389 if (frameRequest.frameName().isEmpty()) |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
725 | 725 |
726 const Settings& settings = m_frame.settings(); | 726 const Settings& settings = m_frame.settings(); |
727 m_frame.document()->cachedResourceLoader().setImagesEnabled(settings.areImag
esEnabled()); | 727 m_frame.document()->cachedResourceLoader().setImagesEnabled(settings.areImag
esEnabled()); |
728 m_frame.document()->cachedResourceLoader().setAutoLoadImages(settings.loadsI
magesAutomatically()); | 728 m_frame.document()->cachedResourceLoader().setAutoLoadImages(settings.loadsI
magesAutomatically()); |
729 | 729 |
730 if (m_documentLoader) { | 730 if (m_documentLoader) { |
731 String dnsPrefetchControl = m_documentLoader->response().httpHeaderField
(HTTPHeaderName::XDNSPrefetchControl); | 731 String dnsPrefetchControl = m_documentLoader->response().httpHeaderField
(HTTPHeaderName::XDNSPrefetchControl); |
732 if (!dnsPrefetchControl.isEmpty()) | 732 if (!dnsPrefetchControl.isEmpty()) |
733 m_frame.document()->parseDNSPrefetchControlHeader(dnsPrefetchControl
); | 733 m_frame.document()->parseDNSPrefetchControlHeader(dnsPrefetchControl
); |
734 | 734 |
735 m_frame.document()->contentSecurityPolicy()->didReceiveHeaders(ContentSe
curityPolicyResponseHeaders(m_documentLoader->response()), ContentSecurityPolicy
::ReportParsingErrors::No); | 735 m_frame.document()->contentSecurityPolicy()->didReceiveHeaders(ContentSe
curityPolicyResponseHeaders(m_documentLoader->response()), referrer(), ContentSe
curityPolicy::ReportParsingErrors::No); |
736 | 736 |
737 String headerContentLanguage = m_documentLoader->response().httpHeaderFi
eld(HTTPHeaderName::ContentLanguage); | 737 String headerContentLanguage = m_documentLoader->response().httpHeaderFi
eld(HTTPHeaderName::ContentLanguage); |
738 if (!headerContentLanguage.isEmpty()) { | 738 if (!headerContentLanguage.isEmpty()) { |
739 size_t commaIndex = headerContentLanguage.find(','); | 739 size_t commaIndex = headerContentLanguage.find(','); |
740 headerContentLanguage.truncate(commaIndex); // notFound == -1 == don
't truncate | 740 headerContentLanguage.truncate(commaIndex); // notFound == -1 == don
't truncate |
741 headerContentLanguage = stripLeadingAndTrailingHTMLSpaces(headerCont
entLanguage); | 741 headerContentLanguage = stripLeadingAndTrailingHTMLSpaces(headerCont
entLanguage); |
742 if (!headerContentLanguage.isEmpty()) | 742 if (!headerContentLanguage.isEmpty()) |
743 m_frame.document()->setContentLanguage(headerContentLanguage); | 743 m_frame.document()->setContentLanguage(headerContentLanguage); |
744 } | 744 } |
| 745 |
| 746 if (m_frame.settings().crossOriginOptionsSupportEnabled()) { |
| 747 String crossOriginOptionsHeader = m_documentLoader->response().httpH
eaderField(HTTPHeaderName::CrossOriginOptions); |
| 748 if (!crossOriginOptionsHeader.isNull()) { |
| 749 ASSERT(m_frame.window()); |
| 750 m_frame.window()->setCrossOriginOptions(parseCrossOriginOptionsH
eader(crossOriginOptionsHeader)); |
| 751 } |
| 752 } |
745 } | 753 } |
746 | 754 |
747 history().restoreDocumentState(); | 755 history().restoreDocumentState(); |
748 } | 756 } |
749 | 757 |
750 void FrameLoader::finishedParsing() | 758 void FrameLoader::finishedParsing() |
751 { | 759 { |
752 LOG(Loading, "WebCoreLoading %s: Finished parsing", m_frame.tree().uniqueNam
e().string().utf8().data()); | 760 LOG(Loading, "WebCoreLoading %s: Finished parsing", m_frame.tree().uniqueNam
e().string().utf8().data()); |
753 | 761 |
754 m_frame.injectUserScripts(InjectAtDocumentEnd); | 762 m_frame.injectUserScripts(InjectAtDocumentEnd); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
798 return true; | 806 return true; |
799 } | 807 } |
800 | 808 |
801 void FrameLoader::checkCompleted() | 809 void FrameLoader::checkCompleted() |
802 { | 810 { |
803 m_shouldCallCheckCompleted = false; | 811 m_shouldCallCheckCompleted = false; |
804 | 812 |
805 // Have we completed before? | 813 // Have we completed before? |
806 if (m_isComplete) | 814 if (m_isComplete) |
807 return; | 815 return; |
| 816 ···· |
| 817 // FIXME: Remove this code once https://webkit.org/b/185284 is fixed. |
| 818 if (HTMLMediaElement::isRunningDestructor()) { |
| 819 ASSERT_NOT_REACHED(); |
| 820 scheduleCheckCompleted(); |
| 821 return; |
| 822 } |
808 | 823 |
809 // FIXME: It would be better if resource loads were kicked off after render
tree update (or didn't complete synchronously). | 824 // FIXME: It would be better if resource loads were kicked off after render
tree update (or didn't complete synchronously). |
810 // https://bugs.webkit.org/show_bug.cgi?id=171729 | 825 // https://bugs.webkit.org/show_bug.cgi?id=171729 |
811 if (m_frame.document()->inRenderTreeUpdate()) { | 826 if (m_frame.document()->inRenderTreeUpdate()) { |
812 scheduleCheckCompleted(); | 827 scheduleCheckCompleted(); |
813 return; | 828 return; |
814 } | 829 } |
815 | 830 |
816 // Are we still parsing? | 831 // Are we still parsing? |
817 if (m_frame.document()->parsing()) | 832 if (m_frame.document()->parsing()) |
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1314 action.setIsCrossOriginWindowOpenNavigation(frameLoadRequest.isCrossOriginWi
ndowOpenNavigation()); | 1329 action.setIsCrossOriginWindowOpenNavigation(frameLoadRequest.isCrossOriginWi
ndowOpenNavigation()); |
1315 if (auto* opener = this->opener()) { | 1330 if (auto* opener = this->opener()) { |
1316 auto pageID = opener->loader().client().pageID(); | 1331 auto pageID = opener->loader().client().pageID(); |
1317 auto frameID = opener->loader().client().frameID(); | 1332 auto frameID = opener->loader().client().frameID(); |
1318 if (pageID && frameID) | 1333 if (pageID && frameID) |
1319 action.setOpener(std::make_pair(*pageID, *frameID)); | 1334 action.setOpener(std::make_pair(*pageID, *frameID)); |
1320 } | 1335 } |
1321 | 1336 |
1322 if (!targetFrame && !frameName.isEmpty()) { | 1337 if (!targetFrame && !frameName.isEmpty()) { |
1323 action = action.copyWithShouldOpenExternalURLsPolicy(shouldOpenExternalU
RLsPolicyToApply(m_frame, frameLoadRequest)); | 1338 action = action.copyWithShouldOpenExternalURLsPolicy(shouldOpenExternalU
RLsPolicyToApply(m_frame, frameLoadRequest)); |
1324 policyChecker().checkNewWindowPolicy(WTFMove(action), request, formState
, frameName, [this, allowNavigationToInvalidURL, openerPolicy, completionHandler
= completionHandlerCaller.release()] (const ResourceRequest& request, FormState
* formState, const String& frameName, const NavigationAction& action, ShouldCont
inue shouldContinue) { | 1339 policyChecker().checkNewWindowPolicy(WTFMove(action), WTFMove(request),
formState, frameName, [this, allowNavigationToInvalidURL, openerPolicy, completi
onHandler = completionHandlerCaller.release()] (const ResourceRequest& request,
FormState* formState, const String& frameName, const NavigationAction& action, S
houldContinue shouldContinue) { |
1325 continueLoadAfterNewWindowPolicy(request, formState, frameName, acti
on, shouldContinue, allowNavigationToInvalidURL, openerPolicy); | 1340 continueLoadAfterNewWindowPolicy(request, formState, frameName, acti
on, shouldContinue, allowNavigationToInvalidURL, openerPolicy); |
1326 completionHandler(); | 1341 completionHandler(); |
1327 }); | 1342 }); |
1328 return; | 1343 return; |
1329 } | 1344 } |
1330 | 1345 |
1331 RefPtr<DocumentLoader> oldDocumentLoader = m_documentLoader; | 1346 RefPtr<DocumentLoader> oldDocumentLoader = m_documentLoader; |
1332 | 1347 |
1333 bool sameURL = shouldTreatURLAsSameAsCurrent(newURL); | 1348 bool sameURL = shouldTreatURLAsSameAsCurrent(newURL); |
1334 const String& httpMethod = request.httpMethod(); | 1349 const String& httpMethod = request.httpMethod(); |
1335 ···· | 1350 ···· |
1336 // Make sure to do scroll to fragment processing even if the URL is | 1351 // Make sure to do scroll to fragment processing even if the URL is |
1337 // exactly the same so pages with '#' links and DHTML side effects | 1352 // exactly the same so pages with '#' links and DHTML side effects |
1338 // work properly. | 1353 // work properly. |
1339 if (shouldPerformFragmentNavigation(isFormSubmission, httpMethod, newLoadTyp
e, newURL)) { | 1354 if (shouldPerformFragmentNavigation(isFormSubmission, httpMethod, newLoadTyp
e, newURL)) { |
1340 oldDocumentLoader->setTriggeringAction(action); | 1355 oldDocumentLoader->setTriggeringAction(action); |
1341 oldDocumentLoader->setLastCheckedRequest(ResourceRequest()); | 1356 oldDocumentLoader->setLastCheckedRequest(ResourceRequest()); |
1342 policyChecker().stopCheck(); | 1357 policyChecker().stopCheck(); |
1343 policyChecker().setLoadType(newLoadType); | 1358 policyChecker().setLoadType(newLoadType); |
1344 policyChecker().checkNavigationPolicy(ResourceRequest(request), false /*
didReceiveRedirectResponse */, oldDocumentLoader.get(), formState, [this, prote
ctedFrame = makeRef(m_frame)] (const ResourceRequest& request, FormState*, Shoul
dContinue shouldContinue) { | 1359 policyChecker().checkNavigationPolicy(WTFMove(request), false /* didRece
iveRedirectResponse */, oldDocumentLoader.get(), formState, [this, protectedFram
e = makeRef(m_frame)] (const ResourceRequest& request, FormState*, ShouldContinu
e shouldContinue) { |
1345 continueFragmentScrollAfterNavigationPolicy(request, shouldContinue
== ShouldContinue::Yes); | 1360 continueFragmentScrollAfterNavigationPolicy(request, shouldContinue
== ShouldContinue::Yes); |
1346 }, PolicyDecisionMode::Synchronous); | 1361 }, PolicyDecisionMode::Synchronous); |
1347 return; | 1362 return; |
1348 } | 1363 } |
1349 | 1364 |
1350 // must grab this now, since this load may stop the previous load and clear
this flag | 1365 // Must grab this now, since this load may stop the previous load and clear
this flag. |
1351 bool isRedirect = m_quickRedirectComing; | 1366 bool isRedirect = m_quickRedirectComing; |
| 1367 request.setSystemPreview(frameLoadRequest.isSystemPreview()); |
1352 loadWithNavigationAction(request, action, lockHistory, newLoadType, formStat
e, allowNavigationToInvalidURL, [this, isRedirect, sameURL, newLoadType, protect
edFrame = makeRef(m_frame), completionHandler = completionHandlerCaller.release(
)] { | 1368 loadWithNavigationAction(request, action, lockHistory, newLoadType, formStat
e, allowNavigationToInvalidURL, [this, isRedirect, sameURL, newLoadType, protect
edFrame = makeRef(m_frame), completionHandler = completionHandlerCaller.release(
)] { |
1353 if (isRedirect) { | 1369 if (isRedirect) { |
1354 m_quickRedirectComing = false; | 1370 m_quickRedirectComing = false; |
1355 if (m_provisionalDocumentLoader) | 1371 if (m_provisionalDocumentLoader) |
1356 m_provisionalDocumentLoader->setIsClientRedirect(true); | 1372 m_provisionalDocumentLoader->setIsClientRedirect(true); |
1357 else if (m_policyDocumentLoader) | 1373 else if (m_policyDocumentLoader) |
1358 m_policyDocumentLoader->setIsClientRedirect(true); | 1374 m_policyDocumentLoader->setIsClientRedirect(true); |
1359 } else if (sameURL && !isReload(newLoadType)) { | 1375 } else if (sameURL && !isReload(newLoadType)) { |
1360 // Example of this case are sites that reload the same URL with a di
fferent cookie | 1376 // Example of this case are sites that reload the same URL with a di
fferent cookie |
1361 // driving the generated content, or a master frame with links that
drive a target | 1377 // driving the generated content, or a master frame with links that
drive a target |
(...skipping 27 matching lines...) Expand all Loading... |
1389 request.setShouldCheckNewWindowPolicy(false); | 1405 request.setShouldCheckNewWindowPolicy(false); |
1390 if (&frame->loader() != this) { | 1406 if (&frame->loader() != this) { |
1391 frame->loader().load(WTFMove(request)); | 1407 frame->loader().load(WTFMove(request)); |
1392 return; | 1408 return; |
1393 } | 1409 } |
1394 } | 1410 } |
1395 } | 1411 } |
1396 | 1412 |
1397 if (request.shouldCheckNewWindowPolicy()) { | 1413 if (request.shouldCheckNewWindowPolicy()) { |
1398 NavigationAction action { request.requester(), request.resourceRequest()
, InitiatedByMainFrame::Unknown, NavigationType::Other, request.shouldOpenExtern
alURLsPolicy() }; | 1414 NavigationAction action { request.requester(), request.resourceRequest()
, InitiatedByMainFrame::Unknown, NavigationType::Other, request.shouldOpenExtern
alURLsPolicy() }; |
1399 policyChecker().checkNewWindowPolicy(WTFMove(action), request.resourceRe
quest(), nullptr, request.frameName(), [this] (const ResourceRequest& request, F
ormState* formState, const String& frameName, const NavigationAction& action, Sh
ouldContinue shouldContinue) { | 1415 policyChecker().checkNewWindowPolicy(WTFMove(action), WTFMove(request.re
sourceRequest()), nullptr, request.frameName(), [this] (const ResourceRequest& r
equest, FormState* formState, const String& frameName, const NavigationAction& a
ction, ShouldContinue shouldContinue) { |
1400 continueLoadAfterNewWindowPolicy(request, formState, frameName, acti
on, shouldContinue, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Supp
ress); | 1416 continueLoadAfterNewWindowPolicy(request, formState, frameName, acti
on, shouldContinue, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Supp
ress); |
1401 }); | 1417 }); |
1402 | 1418 |
1403 return; | 1419 return; |
1404 } | 1420 } |
1405 | 1421 |
1406 if (!request.hasSubstituteData()) | 1422 if (!request.hasSubstituteData()) |
1407 request.setSubstituteData(defaultSubstituteDataForURL(request.resourceRe
quest().url())); | 1423 request.setSubstituteData(defaultSubstituteDataForURL(request.resourceRe
quest().url())); |
1408 | 1424 |
1409 Ref<DocumentLoader> loader = m_client.createDocumentLoader(request.resourceR
equest(), request.substituteData()); | 1425 Ref<DocumentLoader> loader = m_client.createDocumentLoader(request.resourceR
equest(), request.substituteData()); |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1688 | 1704 |
1689 addSameSiteInfoToRequestIfNeeded(request); | 1705 addSameSiteInfoToRequestIfNeeded(request); |
1690 | 1706 |
1691 // If we're about to re-post, set up action so the application can warn the
user. | 1707 // If we're about to re-post, set up action so the application can warn the
user. |
1692 if (request.httpMethod() == "POST") | 1708 if (request.httpMethod() == "POST") |
1693 loader->setTriggeringAction({ *m_frame.document(), request, InitiatedByM
ainFrame::Unknown, NavigationType::FormResubmitted }); | 1709 loader->setTriggeringAction({ *m_frame.document(), request, InitiatedByM
ainFrame::Unknown, NavigationType::FormResubmitted }); |
1694 | 1710 |
1695 loader->setOverrideEncoding(m_documentLoader->overrideEncoding()); | 1711 loader->setOverrideEncoding(m_documentLoader->overrideEncoding()); |
1696 | 1712 |
1697 auto frameLoadTypeForReloadOptions = [] (auto options) { | 1713 auto frameLoadTypeForReloadOptions = [] (auto options) { |
1698 if (options.contains(ReloadOption::FromOrigin)) | 1714 if (options & ReloadOption::FromOrigin) |
1699 return FrameLoadType::ReloadFromOrigin; | 1715 return FrameLoadType::ReloadFromOrigin; |
1700 if (options.contains(ReloadOption::ExpiredOnly)) | 1716 if (options & ReloadOption::ExpiredOnly) |
1701 return FrameLoadType::ReloadExpiredOnly; | 1717 return FrameLoadType::ReloadExpiredOnly; |
1702 return FrameLoadType::Reload; | 1718 return FrameLoadType::Reload; |
1703 }; | 1719 }; |
1704 ···· | 1720 ···· |
1705 loadWithDocumentLoader(loader.ptr(), frameLoadTypeForReloadOptions(options),
0, AllowNavigationToInvalidURL::Yes, NavigationPolicyCheck::Require, [] { }); | 1721 loadWithDocumentLoader(loader.ptr(), frameLoadTypeForReloadOptions(options),
0, AllowNavigationToInvalidURL::Yes, NavigationPolicyCheck::Require, [] { }); |
1706 } | 1722 } |
1707 | 1723 |
1708 void FrameLoader::stopAllLoaders(ClearProvisionalItemPolicy clearProvisionalItem
Policy) | 1724 void FrameLoader::stopAllLoaders(ClearProvisionalItemPolicy clearProvisionalItem
Policy) |
1709 { | 1725 { |
1710 ASSERT(!m_frame.document() || m_frame.document()->pageCacheState() != Docume
nt::InPageCache); | 1726 ASSERT(!m_frame.document() || m_frame.document()->pageCacheState() != Docume
nt::InPageCache); |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1926 | 1942 |
1927 // FIXME: This API should be turned around so that we ground CachedPage
into the Page. | 1943 // FIXME: This API should be turned around so that we ground CachedPage
into the Page. |
1928 cachedPage->restore(*m_frame.page()); | 1944 cachedPage->restore(*m_frame.page()); |
1929 | 1945 |
1930 dispatchDidCommitLoad(hasInsecureContent); | 1946 dispatchDidCommitLoad(hasInsecureContent); |
1931 | 1947 |
1932 #if PLATFORM(IOS) | 1948 #if PLATFORM(IOS) |
1933 m_frame.page()->chrome().setDispatchViewportDataDidChangeSuppressed(fals
e); | 1949 m_frame.page()->chrome().setDispatchViewportDataDidChangeSuppressed(fals
e); |
1934 m_frame.page()->chrome().dispatchViewportPropertiesDidChange(m_frame.pag
e()->viewportArguments()); | 1950 m_frame.page()->chrome().dispatchViewportPropertiesDidChange(m_frame.pag
e()->viewportArguments()); |
1935 #endif | 1951 #endif |
| 1952 m_frame.page()->chrome().dispatchDisabledAdaptationsDidChange(m_frame.pa
ge()->disabledAdaptations()); |
1936 | 1953 |
1937 auto& title = m_documentLoader->title(); | 1954 auto& title = m_documentLoader->title(); |
1938 if (!title.string.isNull()) | 1955 if (!title.string.isNull()) |
1939 m_client.dispatchDidReceiveTitle(title); | 1956 m_client.dispatchDidReceiveTitle(title); |
1940 | 1957 |
1941 // Send remaining notifications for the main resource. | 1958 // Send remaining notifications for the main resource. |
1942 notifier().sendRemainingDelegateMessages(m_documentLoader.get(), mainRes
ourceIdentifier, mainResourceRequest, ResourceResponse(), | 1959 notifier().sendRemainingDelegateMessages(m_documentLoader.get(), mainRes
ourceIdentifier, mainResourceRequest, ResourceResponse(), |
1943 nullptr, static_cast<int>(m_documentLoader->response().expectedConte
ntLength()), 0, mainResouceError); | 1960 nullptr, static_cast<int>(m_documentLoader->response().expectedConte
ntLength()), 0, mainResouceError); |
1944 | 1961 |
1945 checkCompleted(); | 1962 checkCompleted(); |
(...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2837 | 2854 |
2838 NavigationAction action { request.requester(), workingResourceRequest, reque
st.initiatedByMainFrame(), loadType, true, event, request.shouldOpenExternalURLs
Policy(), request.downloadAttribute() }; | 2855 NavigationAction action { request.requester(), workingResourceRequest, reque
st.initiatedByMainFrame(), loadType, true, event, request.shouldOpenExternalURLs
Policy(), request.downloadAttribute() }; |
2839 | 2856 |
2840 if (!frameName.isEmpty()) { | 2857 if (!frameName.isEmpty()) { |
2841 // The search for a target frame is done earlier in the case of form sub
mission. | 2858 // The search for a target frame is done earlier in the case of form sub
mission. |
2842 if (Frame* targetFrame = formState ? 0 : findFrameForNavigation(frameNam
e)) { | 2859 if (Frame* targetFrame = formState ? 0 : findFrameForNavigation(frameNam
e)) { |
2843 targetFrame->loader().loadWithNavigationAction(workingResourceReques
t, action, lockHistory, loadType, WTFMove(formState), allowNavigationToInvalidUR
L, WTFMove(completionHandler)); | 2860 targetFrame->loader().loadWithNavigationAction(workingResourceReques
t, action, lockHistory, loadType, WTFMove(formState), allowNavigationToInvalidUR
L, WTFMove(completionHandler)); |
2844 return; | 2861 return; |
2845 } | 2862 } |
2846 | 2863 |
2847 policyChecker().checkNewWindowPolicy(WTFMove(action), workingResourceReq
uest, WTFMove(formState), frameName, [this, allowNavigationToInvalidURL, openerP
olicy, completionHandler = WTFMove(completionHandler)] (const ResourceRequest& r
equest, FormState* formState, const String& frameName, const NavigationAction& a
ction, ShouldContinue shouldContinue) { | 2864 policyChecker().checkNewWindowPolicy(WTFMove(action), WTFMove(workingRes
ourceRequest), WTFMove(formState), frameName, [this, allowNavigationToInvalidURL
, openerPolicy, completionHandler = WTFMove(completionHandler)] (const ResourceR
equest& request, FormState* formState, const String& frameName, const Navigation
Action& action, ShouldContinue shouldContinue) { |
2848 continueLoadAfterNewWindowPolicy(request, formState, frameName, acti
on, shouldContinue, allowNavigationToInvalidURL, openerPolicy); | 2865 continueLoadAfterNewWindowPolicy(request, formState, frameName, acti
on, shouldContinue, allowNavigationToInvalidURL, openerPolicy); |
2849 completionHandler(); | 2866 completionHandler(); |
2850 }); | 2867 }); |
2851 return; | 2868 return; |
2852 } | 2869 } |
2853 | 2870 |
2854 // must grab this now, since this load may stop the previous load and clear
this flag | 2871 // must grab this now, since this load may stop the previous load and clear
this flag |
2855 bool isRedirect = m_quickRedirectComing; | 2872 bool isRedirect = m_quickRedirectComing; |
2856 loadWithNavigationAction(workingResourceRequest, action, lockHistory, loadTy
pe, WTFMove(formState), allowNavigationToInvalidURL, [this, isRedirect, protecte
dFrame = makeRef(m_frame), completionHandler = WTFMove(completionHandler)] { | 2873 loadWithNavigationAction(workingResourceRequest, action, lockHistory, loadTy
pe, WTFMove(formState), allowNavigationToInvalidURL, [this, isRedirect, protecte
dFrame = makeRef(m_frame), completionHandler = WTFMove(completionHandler)] { |
2857 if (isRedirect) { | 2874 if (isRedirect) { |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3202 void FrameLoader::continueLoadAfterNavigationPolicy(const ResourceRequest& reque
st, FormState* formState, ShouldContinue shouldContinue, AllowNavigationToInvali
dURL allowNavigationToInvalidURL) | 3219 void FrameLoader::continueLoadAfterNavigationPolicy(const ResourceRequest& reque
st, FormState* formState, ShouldContinue shouldContinue, AllowNavigationToInvali
dURL allowNavigationToInvalidURL) |
3203 { | 3220 { |
3204 // If we loaded an alternate page to replace an unreachableURL, we'll get in
here with a | 3221 // If we loaded an alternate page to replace an unreachableURL, we'll get in
here with a |
3205 // nil policyDataSource because loading the alternate page will have passed | 3222 // nil policyDataSource because loading the alternate page will have passed |
3206 // through this method already, nested; otherwise, policyDataSource should s
till be set. | 3223 // through this method already, nested; otherwise, policyDataSource should s
till be set. |
3207 ASSERT(m_policyDocumentLoader || !m_provisionalDocumentLoader->unreachableUR
L().isEmpty()); | 3224 ASSERT(m_policyDocumentLoader || !m_provisionalDocumentLoader->unreachableUR
L().isEmpty()); |
3208 | 3225 |
3209 bool isTargetItem = history().provisionalItem() ? history().provisionalItem(
)->isTargetItem() : false; | 3226 bool isTargetItem = history().provisionalItem() ? history().provisionalItem(
)->isTargetItem() : false; |
3210 | 3227 |
3211 bool urlIsDisallowed = allowNavigationToInvalidURL == AllowNavigationToInval
idURL::No && !request.url().isValid(); | 3228 bool urlIsDisallowed = allowNavigationToInvalidURL == AllowNavigationToInval
idURL::No && !request.url().isValid(); |
3212 bool canContinue = shouldContinue != ShouldContinue::No && shouldClose() &&
!urlIsDisallowed; | 3229 bool canContinue = (shouldContinue != ShouldContinue::No && shouldContinue !
= ShouldContinue::NoAndLockBackForwardList) && shouldClose() && !urlIsDisallowed
; |
3213 | 3230 |
3214 if (!canContinue) { | 3231 if (!canContinue) { |
3215 // If we were waiting for a quick redirect, but the policy delegate deci
ded to ignore it, then we· | 3232 // If we were waiting for a quick redirect, but the policy delegate deci
ded to ignore it, then we· |
3216 // need to report that the client redirect was cancelled. | 3233 // need to report that the client redirect was cancelled. |
3217 // FIXME: The client should be told about ignored non-quick redirects, t
oo. | 3234 // FIXME: The client should be told about ignored non-quick redirects, t
oo. |
3218 if (m_quickRedirectComing) | 3235 if (m_quickRedirectComing) |
3219 clientRedirectCancelledOrFinished(false); | 3236 clientRedirectCancelledOrFinished(false); |
3220 | 3237 |
3221 setPolicyDocumentLoader(nullptr); | 3238 setPolicyDocumentLoader(nullptr); |
3222 checkCompleted(); | 3239 checkCompleted(); |
3223 checkLoadComplete(); | 3240 checkLoadComplete(); |
3224 | 3241 |
3225 // If the navigation request came from the back/forward menu, and we pun
t on it, we have the· | 3242 // If the navigation request came from the back/forward menu, and we pun
t on it, we have the· |
3226 // problem that we have optimistically moved the b/f cursor already, so
move it back. For sanity, | 3243 // problem that we have optimistically moved the b/f cursor already, so
move it back. For sanity, |
3227 // we only do this when punting a navigation for the target frame or top
-level frame.·· | 3244 // we only do this when punting a navigation for the target frame or top
-level frame.·· |
3228 if ((isTargetItem || m_frame.isMainFrame()) && isBackForwardLoadType(pol
icyChecker().loadType()) && shouldContinue != ShouldContinue::NoAndLockBackForwa
rdList) { | 3245 if ((isTargetItem || m_frame.isMainFrame()) && isBackForwardLoadType(pol
icyChecker().loadType())) { |
3229 if (Page* page = m_frame.page()) { | 3246 if (shouldContinue == ShouldContinue::NoAndLockBackForwardList) { |
| 3247 m_loadType = policyChecker().loadType(); |
| 3248 m_frame.mainFrame().loader().history().updateForCommit(); |
| 3249 } else if (Page* page = m_frame.page()) { |
3230 if (HistoryItem* resetItem = m_frame.mainFrame().loader().histor
y().currentItem()) { | 3250 if (HistoryItem* resetItem = m_frame.mainFrame().loader().histor
y().currentItem()) { |
3231 page->backForward().setCurrentItem(resetItem); | 3251 page->backForward().setCurrentItem(resetItem); |
3232 m_frame.loader().client().updateGlobalHistoryItemForPage(); | 3252 m_frame.loader().client().updateGlobalHistoryItemForPage(); |
3233 } | 3253 } |
3234 } | 3254 } |
3235 } | 3255 } |
3236 return; | 3256 return; |
3237 } | 3257 } |
3238 | 3258 |
3239 FrameLoadType type = policyChecker().loadType(); | 3259 FrameLoadType type = policyChecker().loadType(); |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3399 | 3419 |
3400 XFrameOptionsDisposition disposition = parseXFrameOptionsHeader(content); | 3420 XFrameOptionsDisposition disposition = parseXFrameOptionsHeader(content); |
3401 | 3421 |
3402 switch (disposition) { | 3422 switch (disposition) { |
3403 case XFrameOptionsSameOrigin: { | 3423 case XFrameOptionsSameOrigin: { |
3404 RefPtr<SecurityOrigin> origin = SecurityOrigin::create(url); | 3424 RefPtr<SecurityOrigin> origin = SecurityOrigin::create(url); |
3405 if (!origin->isSameSchemeHostPort(topFrame.document()->securityOrigin())
) | 3425 if (!origin->isSameSchemeHostPort(topFrame.document()->securityOrigin())
) |
3406 return true; | 3426 return true; |
3407 for (Frame* frame = m_frame.tree().parent(); frame; frame = frame->tree(
).parent()) { | 3427 for (Frame* frame = m_frame.tree().parent(); frame; frame = frame->tree(
).parent()) { |
3408 if (!origin->isSameSchemeHostPort(frame->document()->securityOrigin(
))) | 3428 if (!origin->isSameSchemeHostPort(frame->document()->securityOrigin(
))) |
3409 break; | 3429 return true; |
3410 } | 3430 } |
3411 return false; | 3431 return false; |
3412 } | 3432 } |
3413 case XFrameOptionsDeny: | 3433 case XFrameOptionsDeny: |
3414 return true; | 3434 return true; |
3415 case XFrameOptionsAllowAll: | 3435 case XFrameOptionsAllowAll: |
3416 return false; | 3436 return false; |
3417 case XFrameOptionsConflict: | 3437 case XFrameOptionsConflict: |
3418 m_frame.document()->addConsoleMessage(MessageSource::JS, MessageLevel::E
rror, "Multiple 'X-Frame-Options' headers with conflicting values ('" + content
+ "') encountered when loading '" + url.stringCenterEllipsizedToLength() + "'. F
alling back to 'DENY'.", requestIdentifier); | 3438 m_frame.document()->addConsoleMessage(MessageSource::JS, MessageLevel::E
rror, "Multiple 'X-Frame-Options' headers with conflicting values ('" + content
+ "') encountered when loading '" + url.stringCenterEllipsizedToLength() + "'. F
alling back to 'DENY'.", requestIdentifier); |
3419 return true; | 3439 return true; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3507 // Remember this item so we can traverse any child items as child frames loa
d | 3527 // Remember this item so we can traverse any child items as child frames loa
d |
3508 history().setProvisionalItem(&item); | 3528 history().setProvisionalItem(&item); |
3509 | 3529 |
3510 auto initiatedByMainFrame = InitiatedByMainFrame::Unknown; | 3530 auto initiatedByMainFrame = InitiatedByMainFrame::Unknown; |
3511 | 3531 |
3512 SetForScope<bool> currentLoadShouldCheckNavigationPolicyGuard(m_currentLoadS
houldCheckNavigationPolicy, navigationPolicyCheck != NavigationPolicyCheck::Bypa
ss); | 3532 SetForScope<bool> currentLoadShouldCheckNavigationPolicyGuard(m_currentLoadS
houldCheckNavigationPolicy, navigationPolicyCheck != NavigationPolicyCheck::Bypa
ss); |
3513 | 3533 |
3514 if (CachedPage* cachedPage = PageCache::singleton().get(item, m_frame.page()
)) { | 3534 if (CachedPage* cachedPage = PageCache::singleton().get(item, m_frame.page()
)) { |
3515 auto documentLoader = cachedPage->documentLoader(); | 3535 auto documentLoader = cachedPage->documentLoader(); |
3516 m_client.updateCachedDocumentLoader(*documentLoader); | 3536 m_client.updateCachedDocumentLoader(*documentLoader); |
3517 documentLoader->setTriggeringAction({ *m_frame.document(), documentLoade
r->request(), initiatedByMainFrame, loadType, false }); | 3537 |
| 3538 auto action = NavigationAction { *m_frame.document(), documentLoader->re
quest(), initiatedByMainFrame, loadType, false }; |
| 3539 action.setTargetBackForwardItem(item); |
| 3540 documentLoader->setTriggeringAction(WTFMove(action)); |
| 3541 |
3518 documentLoader->setLastCheckedRequest(ResourceRequest()); | 3542 documentLoader->setLastCheckedRequest(ResourceRequest()); |
3519 loadWithDocumentLoader(documentLoader, loadType, 0, AllowNavigationToInv
alidURL::Yes, navigationPolicyCheck, [] { }); | 3543 loadWithDocumentLoader(documentLoader, loadType, 0, AllowNavigationToInv
alidURL::Yes, navigationPolicyCheck, [] { }); |
3520 return; | 3544 return; |
3521 } | 3545 } |
3522 | 3546 |
3523 URL itemURL = item.url(); | 3547 URL itemURL = item.url(); |
3524 URL itemOriginalURL = item.originalURL(); | 3548 URL itemOriginalURL = item.originalURL(); |
3525 URL currentURL; | 3549 URL currentURL; |
3526 if (documentLoader()) | 3550 if (documentLoader()) |
3527 currentURL = documentLoader()->url(); | 3551 currentURL = documentLoader()->url(); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3595 ASSERT_NOT_REACHED(); | 3619 ASSERT_NOT_REACHED(); |
3596 } | 3620 } |
3597 | 3621 |
3598 addExtraFieldsToRequest(request, loadType, true); | 3622 addExtraFieldsToRequest(request, loadType, true); |
3599 | 3623 |
3600 ResourceRequest requestForOriginalURL(request); | 3624 ResourceRequest requestForOriginalURL(request); |
3601 requestForOriginalURL.setURL(itemOriginalURL); | 3625 requestForOriginalURL.setURL(itemOriginalURL); |
3602 action = { *m_frame.document(), requestForOriginalURL, initiatedByMainFr
ame, loadType, isFormSubmission, event, shouldOpenExternalURLsPolicy }; | 3626 action = { *m_frame.document(), requestForOriginalURL, initiatedByMainFr
ame, loadType, isFormSubmission, event, shouldOpenExternalURLsPolicy }; |
3603 } | 3627 } |
3604 | 3628 |
| 3629 action.setTargetBackForwardItem(item); |
| 3630 |
3605 loadWithNavigationAction(request, action, LockHistory::No, loadType, 0, Allo
wNavigationToInvalidURL::Yes, [] { }); | 3631 loadWithNavigationAction(request, action, LockHistory::No, loadType, 0, Allo
wNavigationToInvalidURL::Yes, [] { }); |
3606 } | 3632 } |
3607 | 3633 |
3608 // Loads content into this frame, as specified by history item | 3634 // Loads content into this frame, as specified by history item |
3609 void FrameLoader::loadItem(HistoryItem& item, FrameLoadType loadType, Navigation
PolicyCheck navigationPolicyCheck) | 3635 void FrameLoader::loadItem(HistoryItem& item, FrameLoadType loadType, Navigation
PolicyCheck navigationPolicyCheck) |
3610 { | 3636 { |
3611 m_requestedHistoryItem = &item; | 3637 m_requestedHistoryItem = &item; |
3612 HistoryItem* currentItem = history().currentItem(); | 3638 HistoryItem* currentItem = history().currentItem(); |
3613 bool sameDocumentNavigation = currentItem && item.shouldDoSameDocumentNaviga
tionTo(*currentItem); | 3639 bool sameDocumentNavigation = currentItem && item.shouldDoSameDocumentNaviga
tionTo(*currentItem); |
3614 | 3640 |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3935 created = true; | 3961 created = true; |
3936 return frame; | 3962 return frame; |
3937 } | 3963 } |
3938 | 3964 |
3939 bool FrameLoader::shouldSuppressTextInputFromEditing() const | 3965 bool FrameLoader::shouldSuppressTextInputFromEditing() const |
3940 { | 3966 { |
3941 return m_frame.settings().shouldSuppressTextInputFromEditingDuringProvisiona
lNavigation() && m_state == FrameStateProvisional; | 3967 return m_frame.settings().shouldSuppressTextInputFromEditingDuringProvisiona
lNavigation() && m_state == FrameStateProvisional; |
3942 } | 3968 } |
3943 | 3969 |
3944 } // namespace WebCore | 3970 } // namespace WebCore |
LEFT | RIGHT |