| 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 1719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1730 | 1730 |
| 1731 if (!checkLoadCanStart(frameLoadRequest, type, navigationPolicy, | 1731 if (!checkLoadCanStart(frameLoadRequest, type, navigationPolicy, |
| 1732 navigationType)) { | 1732 navigationType)) { |
| 1733 // PlzNavigate: if the navigation is a commit of a client-handled | 1733 // PlzNavigate: if the navigation is a commit of a client-handled |
| 1734 // navigation, record that there is no longer a navigation handled by the | 1734 // navigation, record that there is no longer a navigation handled by the |
| 1735 // client. | 1735 // client. |
| 1736 if (m_isNavigationHandledByClient && | 1736 if (m_isNavigationHandledByClient && |
| 1737 !frameLoadRequest.resourceRequest().checkForBrowserSideNavigation()) { | 1737 !frameLoadRequest.resourceRequest().checkForBrowserSideNavigation()) { |
| 1738 m_isNavigationHandledByClient = false; | 1738 m_isNavigationHandledByClient = false; |
| 1739 } | 1739 } |
| 1740 DocumentLoader* loader = createDocumentLoader( |
| 1741 resourceRequest, frameLoadRequest, type, navigationType); |
| 1742 // PlzNavigate: If the navigation is handled by the client, then the |
| 1743 // didFinishDocumentLoad() event occurs before the |
| 1744 // didStartProvisionalLoad() notification which occurs after the navigation |
| 1745 // is committed. This causes a number of layout tests to fail. We |
| 1746 // workaround this by invoking the didStartProvisionalLoad() notification |
| 1747 // here. Consumers of the didStartProvisionalLoad() notification rely on |
| 1748 // the provisional loader and save navigation state in it. We want to avoid |
| 1749 // this dependency on the provisional loader. For now we create a temporary |
| 1750 // loader and pass it to the didStartProvisionalLoad() function. |
| 1751 // TODO(ananta) |
| 1752 // We should get rid of the dependency on the DocumentLoader in consumers of |
| 1753 // the didStartProvisionalLoad() notification. |
| 1754 client()->dispatchDidStartProvisionalLoad(loader); |
| 1755 DCHECK(loader); |
| 1756 loader->setSentDidFinishLoad(); |
| 1757 loader->detachFromFrame(); |
| 1740 return; | 1758 return; |
| 1741 } | 1759 } |
| 1742 | 1760 |
| 1743 m_provisionalDocumentLoader = client()->createDocumentLoader( | 1761 m_provisionalDocumentLoader = createDocumentLoader( |
| 1744 m_frame, resourceRequest, | 1762 resourceRequest, frameLoadRequest, type, navigationType); |
| 1745 frameLoadRequest.substituteData().isValid() | 1763 |
| 1746 ? frameLoadRequest.substituteData() | 1764 // TODO(ananta) |
| 1747 : defaultSubstituteDataForURL(resourceRequest.url()), | 1765 // We should get rid of the dependency on the DocumentLoader in consumers of |
| 1748 frameLoadRequest.clientRedirect()); | 1766 // the didStartProvisionalLoad() notification. |
| 1749 m_provisionalDocumentLoader->setLoadType(type); | 1767 client()->dispatchDidStartProvisionalLoad(m_provisionalDocumentLoader); |
| 1750 m_provisionalDocumentLoader->setNavigationType(navigationType); | 1768 DCHECK(m_provisionalDocumentLoader); |
| 1751 m_provisionalDocumentLoader->setReplacesCurrentHistoryItem( | |
| 1752 type == FrameLoadTypeReplaceCurrentItem); | |
| 1753 | 1769 |
| 1754 // PlzNavigate: We need to ensure that script initiated navigations are | 1770 // PlzNavigate: We need to ensure that script initiated navigations are |
| 1755 // honored. | 1771 // honored. |
| 1756 if (!m_isNavigationHandledByClient) { | 1772 if (!m_isNavigationHandledByClient) { |
| 1757 m_frame->navigationScheduler().cancel(); | 1773 m_frame->navigationScheduler().cancel(); |
| 1758 m_checkTimer.stop(); | 1774 m_checkTimer.stop(); |
| 1759 } | 1775 } |
| 1760 | 1776 |
| 1761 if (frameLoadRequest.form()) | 1777 if (frameLoadRequest.form()) |
| 1762 client()->dispatchWillSubmitForm(frameLoadRequest.form()); | 1778 client()->dispatchWillSubmitForm(frameLoadRequest.form()); |
| 1763 | 1779 |
| 1764 // If the loader wasn't waiting for the client to handle a navigation, update | 1780 // If the loader wasn't waiting for the client to handle a navigation, update |
| 1765 // the progress tracker. Otherwise don't, as it was already notified before | 1781 // the progress tracker. Otherwise don't, as it was already notified before |
| 1766 // sending the navigation to teh client. | 1782 // sending the navigation to teh client. |
| 1767 if (!m_isNavigationHandledByClient) | 1783 if (!m_isNavigationHandledByClient) |
| 1768 m_progressTracker->progressStarted(type); | 1784 m_progressTracker->progressStarted(type); |
| 1769 else | 1785 else |
| 1770 m_isNavigationHandledByClient = false; | 1786 m_isNavigationHandledByClient = false; |
| 1771 | 1787 |
| 1772 m_provisionalDocumentLoader->appendRedirect( | 1788 m_provisionalDocumentLoader->appendRedirect( |
| 1773 m_provisionalDocumentLoader->getRequest().url()); | 1789 m_provisionalDocumentLoader->getRequest().url()); |
| 1774 client()->dispatchDidStartProvisionalLoad(); | 1790 |
| 1775 DCHECK(m_provisionalDocumentLoader); | |
| 1776 m_provisionalDocumentLoader->startLoadingMainResource(); | 1791 m_provisionalDocumentLoader->startLoadingMainResource(); |
| 1777 | 1792 |
| 1778 takeObjectSnapshot(); | 1793 takeObjectSnapshot(); |
| 1779 } | 1794 } |
| 1780 | 1795 |
| 1781 void FrameLoader::applyUserAgent(ResourceRequest& request) { | 1796 void FrameLoader::applyUserAgent(ResourceRequest& request) { |
| 1782 String userAgent = this->userAgent(); | 1797 String userAgent = this->userAgent(); |
| 1783 DCHECK(!userAgent.isNull()); | 1798 DCHECK(!userAgent.isNull()); |
| 1784 request.setHTTPUserAgent(AtomicString(userAgent)); | 1799 request.setHTTPUserAgent(AtomicString(userAgent)); |
| 1785 } | 1800 } |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1956 tracedValue->setString("documentLoaderURL", | 1971 tracedValue->setString("documentLoaderURL", |
| 1957 m_documentLoader ? m_documentLoader->url() : String()); | 1972 m_documentLoader ? m_documentLoader->url() : String()); |
| 1958 return tracedValue; | 1973 return tracedValue; |
| 1959 } | 1974 } |
| 1960 | 1975 |
| 1961 inline void FrameLoader::takeObjectSnapshot() const { | 1976 inline void FrameLoader::takeObjectSnapshot() const { |
| 1962 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, | 1977 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, |
| 1963 toTracedValue()); | 1978 toTracedValue()); |
| 1964 } | 1979 } |
| 1965 | 1980 |
| 1981 DocumentLoader* FrameLoader::createDocumentLoader( |
| 1982 const ResourceRequest& request, |
| 1983 const FrameLoadRequest& frameLoadRequest, |
| 1984 FrameLoadType loadType, |
| 1985 NavigationType navigationType) { |
| 1986 DocumentLoader* loader = client()->createDocumentLoader( |
| 1987 m_frame, request, frameLoadRequest.substituteData().isValid() |
| 1988 ? frameLoadRequest.substituteData() |
| 1989 : defaultSubstituteDataForURL(request.url()), |
| 1990 frameLoadRequest.clientRedirect()); |
| 1991 |
| 1992 loader->setLoadType(loadType); |
| 1993 loader->setNavigationType(navigationType); |
| 1994 loader->setReplacesCurrentHistoryItem(loadType == |
| 1995 FrameLoadTypeReplaceCurrentItem); |
| 1996 return loader; |
| 1997 } |
| 1998 |
| 1966 } // namespace blink | 1999 } // namespace blink |
| OLD | NEW |