| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights |
| 3 * reserved. | 3 * reserved. |
| 4 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 4 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
| 5 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 5 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
| 6 * (http://www.torchmobile.com/) | 6 * (http://www.torchmobile.com/) |
| 7 * Copyright (C) 2008 Alp Toker <alp@atoker.com> | 7 * Copyright (C) 2008 Alp Toker <alp@atoker.com> |
| 8 * Copyright (C) Research In Motion Limited 2009. All rights reserved. | 8 * Copyright (C) Research In Motion Limited 2009. All rights reserved. |
| 9 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> | 9 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> |
| 10 * Copyright (C) 2011 Google Inc. All rights reserved. | 10 * Copyright (C) 2011 Google Inc. All rights reserved. |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 visitor->trace(m_provisionalItem); | 221 visitor->trace(m_provisionalItem); |
| 222 visitor->trace(m_deferredHistoryLoad); | 222 visitor->trace(m_deferredHistoryLoad); |
| 223 } | 223 } |
| 224 | 224 |
| 225 void FrameLoader::init() { | 225 void FrameLoader::init() { |
| 226 ResourceRequest initialRequest(KURL(ParsedURLString, emptyString)); | 226 ResourceRequest initialRequest(KURL(ParsedURLString, emptyString)); |
| 227 initialRequest.setRequestContext(WebURLRequest::RequestContextInternal); | 227 initialRequest.setRequestContext(WebURLRequest::RequestContextInternal); |
| 228 initialRequest.setFrameType(m_frame->isMainFrame() | 228 initialRequest.setFrameType(m_frame->isMainFrame() |
| 229 ? WebURLRequest::FrameTypeTopLevel | 229 ? WebURLRequest::FrameTypeTopLevel |
| 230 : WebURLRequest::FrameTypeNested); | 230 : WebURLRequest::FrameTypeNested); |
| 231 m_provisionalDocumentLoader = | 231 // TODO(dcheng): Strictly speaking, this should be passing in the creator of |
| 232 client()->createDocumentLoader(m_frame, initialRequest, SubstituteData(), | 232 // the frame. |
| 233 ClientRedirectPolicy::NotClientRedirect); | 233 m_provisionalDocumentLoader = client()->createDocumentLoader( |
| 234 m_frame, initialRequest, SubstituteData(), |
| 235 ClientRedirectPolicy::NotClientRedirect, nullptr); |
| 234 m_provisionalDocumentLoader->startLoadingMainResource(); | 236 m_provisionalDocumentLoader->startLoadingMainResource(); |
| 235 m_frame->document()->cancelParsing(); | 237 m_frame->document()->cancelParsing(); |
| 236 m_stateMachine.advanceTo( | 238 m_stateMachine.advanceTo( |
| 237 FrameLoaderStateMachine::DisplayingInitialEmptyDocument); | 239 FrameLoaderStateMachine::DisplayingInitialEmptyDocument); |
| 238 // Suppress finish notifications for inital empty documents, since they don't | 240 // Suppress finish notifications for inital empty documents, since they don't |
| 239 // generate start notifications. | 241 // generate start notifications. |
| 240 if (m_documentLoader) | 242 if (m_documentLoader) |
| 241 m_documentLoader->setSentDidFinishLoad(); | 243 m_documentLoader->setSentDidFinishLoad(); |
| 242 // Self-suspend if created in an already suspended Page. Note that both | 244 // Self-suspend if created in an already suspended Page. Note that both |
| 243 // startLoadingMainResource() and cancelParsing() may have already detached | 245 // startLoadingMainResource() and cancelParsing() may have already detached |
| (...skipping 1256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1500 } | 1502 } |
| 1501 | 1503 |
| 1502 if (i == targetFrames.size()) | 1504 if (i == targetFrames.size()) |
| 1503 shouldClose = true; | 1505 shouldClose = true; |
| 1504 } | 1506 } |
| 1505 | 1507 |
| 1506 return shouldClose; | 1508 return shouldClose; |
| 1507 } | 1509 } |
| 1508 | 1510 |
| 1509 NavigationPolicy FrameLoader::shouldContinueForNavigationPolicy( | 1511 NavigationPolicy FrameLoader::shouldContinueForNavigationPolicy( |
| 1512 Document* originDocument, |
| 1510 const ResourceRequest& request, | 1513 const ResourceRequest& request, |
| 1511 const SubstituteData& substituteData, | 1514 const SubstituteData& substituteData, |
| 1512 DocumentLoader* loader, | 1515 DocumentLoader* loader, |
| 1513 ContentSecurityPolicyDisposition shouldCheckMainWorldContentSecurityPolicy, | 1516 ContentSecurityPolicyDisposition shouldCheckMainWorldContentSecurityPolicy, |
| 1514 NavigationType type, | 1517 NavigationType type, |
| 1515 NavigationPolicy policy, | 1518 NavigationPolicy policy, |
| 1516 FrameLoadType frameLoadType, | 1519 FrameLoadType frameLoadType, |
| 1517 bool isClientRedirect, | 1520 bool isClientRedirect, |
| 1518 HTMLFormElement* form) { | 1521 HTMLFormElement* form) { |
| 1519 // Don't ask if we are loading an empty URL. | 1522 // Don't ask if we are loading an empty URL. |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1564 // see https://crbug.com/701749 | 1567 // see https://crbug.com/701749 |
| 1565 !browserSideNavigationEnabled && | 1568 !browserSideNavigationEnabled && |
| 1566 !m_frame->document()->contentSecurityPolicy()->allowFormAction( | 1569 !m_frame->document()->contentSecurityPolicy()->allowFormAction( |
| 1567 request.url(), request.redirectStatus())) { | 1570 request.url(), request.redirectStatus())) { |
| 1568 return NavigationPolicyIgnore; | 1571 return NavigationPolicyIgnore; |
| 1569 } | 1572 } |
| 1570 | 1573 |
| 1571 bool replacesCurrentHistoryItem = | 1574 bool replacesCurrentHistoryItem = |
| 1572 frameLoadType == FrameLoadTypeReplaceCurrentItem; | 1575 frameLoadType == FrameLoadTypeReplaceCurrentItem; |
| 1573 policy = client()->decidePolicyForNavigation( | 1576 policy = client()->decidePolicyForNavigation( |
| 1574 request, loader, type, policy, replacesCurrentHistoryItem, | 1577 originDocument, request, loader, type, policy, replacesCurrentHistoryItem, |
| 1575 isClientRedirect, form, shouldCheckMainWorldContentSecurityPolicy); | 1578 isClientRedirect, form, shouldCheckMainWorldContentSecurityPolicy); |
| 1576 if (policy == NavigationPolicyCurrentTab || | 1579 if (policy == NavigationPolicyCurrentTab || |
| 1577 policy == NavigationPolicyIgnore || | 1580 policy == NavigationPolicyIgnore || |
| 1578 policy == NavigationPolicyHandledByClient || | 1581 policy == NavigationPolicyHandledByClient || |
| 1579 policy == NavigationPolicyHandledByClientForInitialHistory) { | 1582 policy == NavigationPolicyHandledByClientForInitialHistory) { |
| 1580 return policy; | 1583 return policy; |
| 1581 } | 1584 } |
| 1582 | 1585 |
| 1583 if (!LocalDOMWindow::allowPopUp(*m_frame) && | 1586 if (!LocalDOMWindow::allowPopUp(*m_frame) && |
| 1584 !UserGestureIndicator::utilizeUserGesture()) | 1587 !UserGestureIndicator::utilizeUserGesture()) |
| 1585 return NavigationPolicyIgnore; | 1588 return NavigationPolicyIgnore; |
| 1589 // TODO(dcheng): Does this need to plumb the origin document through? |
| 1586 client()->loadURLExternally(request, policy, String(), | 1590 client()->loadURLExternally(request, policy, String(), |
| 1587 replacesCurrentHistoryItem); | 1591 replacesCurrentHistoryItem); |
| 1588 return NavigationPolicyIgnore; | 1592 return NavigationPolicyIgnore; |
| 1589 } | 1593 } |
| 1590 | 1594 |
| 1591 NavigationPolicy FrameLoader::checkLoadCanStart( | 1595 NavigationPolicy FrameLoader::checkLoadCanStart( |
| 1592 FrameLoadRequest& frameLoadRequest, | 1596 FrameLoadRequest& frameLoadRequest, |
| 1593 FrameLoadType type, | 1597 FrameLoadType type, |
| 1594 NavigationPolicy navigationPolicy, | 1598 NavigationPolicy navigationPolicy, |
| 1595 NavigationType navigationType) { | 1599 NavigationType navigationType) { |
| 1596 if (m_frame->document()->pageDismissalEventBeingDispatched() != | 1600 if (m_frame->document()->pageDismissalEventBeingDispatched() != |
| 1597 Document::NoDismissal) { | 1601 Document::NoDismissal) { |
| 1598 return NavigationPolicyIgnore; | 1602 return NavigationPolicyIgnore; |
| 1599 } | 1603 } |
| 1600 | 1604 |
| 1601 // Record the latest requiredCSP value that will be used when sending this | 1605 // Record the latest requiredCSP value that will be used when sending this |
| 1602 // request. | 1606 // request. |
| 1603 ResourceRequest& resourceRequest = frameLoadRequest.resourceRequest(); | 1607 ResourceRequest& resourceRequest = frameLoadRequest.resourceRequest(); |
| 1604 recordLatestRequiredCSP(); | 1608 recordLatestRequiredCSP(); |
| 1605 modifyRequestForCSP(resourceRequest, nullptr); | 1609 modifyRequestForCSP(resourceRequest, nullptr); |
| 1606 | 1610 |
| 1607 return shouldContinueForNavigationPolicy( | 1611 return shouldContinueForNavigationPolicy( |
| 1608 resourceRequest, frameLoadRequest.substituteData(), nullptr, | 1612 frameLoadRequest.originDocument(), resourceRequest, |
| 1613 frameLoadRequest.substituteData(), nullptr, |
| 1609 frameLoadRequest.shouldCheckMainWorldContentSecurityPolicy(), | 1614 frameLoadRequest.shouldCheckMainWorldContentSecurityPolicy(), |
| 1610 navigationType, navigationPolicy, type, | 1615 navigationType, navigationPolicy, type, |
| 1611 frameLoadRequest.clientRedirect() == ClientRedirectPolicy::ClientRedirect, | 1616 frameLoadRequest.clientRedirect() == ClientRedirectPolicy::ClientRedirect, |
| 1612 frameLoadRequest.form()); | 1617 frameLoadRequest.form()); |
| 1613 } | 1618 } |
| 1614 | 1619 |
| 1615 void FrameLoader::startLoad(FrameLoadRequest& frameLoadRequest, | 1620 void FrameLoader::startLoad(FrameLoadRequest& frameLoadRequest, |
| 1616 FrameLoadType type, | 1621 FrameLoadType type, |
| 1617 NavigationPolicy navigationPolicy) { | 1622 NavigationPolicy navigationPolicy) { |
| 1618 DCHECK(client()->hasWebView()); | 1623 DCHECK(client()->hasWebView()); |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1887 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, | 1892 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, |
| 1888 toTracedValue()); | 1893 toTracedValue()); |
| 1889 } | 1894 } |
| 1890 | 1895 |
| 1891 DocumentLoader* FrameLoader::createDocumentLoader( | 1896 DocumentLoader* FrameLoader::createDocumentLoader( |
| 1892 const ResourceRequest& request, | 1897 const ResourceRequest& request, |
| 1893 const FrameLoadRequest& frameLoadRequest, | 1898 const FrameLoadRequest& frameLoadRequest, |
| 1894 FrameLoadType loadType, | 1899 FrameLoadType loadType, |
| 1895 NavigationType navigationType) { | 1900 NavigationType navigationType) { |
| 1896 DocumentLoader* loader = client()->createDocumentLoader( | 1901 DocumentLoader* loader = client()->createDocumentLoader( |
| 1897 m_frame, request, frameLoadRequest.substituteData().isValid() | 1902 m_frame, request, |
| 1898 ? frameLoadRequest.substituteData() | 1903 frameLoadRequest.substituteData().isValid() |
| 1899 : defaultSubstituteDataForURL(request.url()), | 1904 ? frameLoadRequest.substituteData() |
| 1900 frameLoadRequest.clientRedirect()); | 1905 : defaultSubstituteDataForURL(request.url()), |
| 1906 frameLoadRequest.clientRedirect(), frameLoadRequest.originDocument()); |
| 1901 | 1907 |
| 1902 loader->setLoadType(loadType); | 1908 loader->setLoadType(loadType); |
| 1903 loader->setNavigationType(navigationType); | 1909 loader->setNavigationType(navigationType); |
| 1904 loader->setReplacesCurrentHistoryItem(loadType == | 1910 loader->setReplacesCurrentHistoryItem(loadType == |
| 1905 FrameLoadTypeReplaceCurrentItem); | 1911 FrameLoadTypeReplaceCurrentItem); |
| 1906 return loader; | 1912 return loader; |
| 1907 } | 1913 } |
| 1908 | 1914 |
| 1909 } // namespace blink | 1915 } // namespace blink |
| OLD | NEW |