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 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
792 // Update the data source's request with the new URL to fake the URL change | 792 // Update the data source's request with the new URL to fake the URL change |
793 m_frame->document()->setURL(newURL); | 793 m_frame->document()->setURL(newURL); |
794 documentLoader()->setReplacesCurrentHistoryItem(type != | 794 documentLoader()->setReplacesCurrentHistoryItem(type != |
795 FrameLoadTypeStandard); | 795 FrameLoadTypeStandard); |
796 documentLoader()->updateForSameDocumentNavigation( | 796 documentLoader()->updateForSameDocumentNavigation( |
797 newURL, sameDocumentNavigationSource); | 797 newURL, sameDocumentNavigationSource); |
798 | 798 |
799 // Generate start and stop notifications only when loader is completed so that | 799 // Generate start and stop notifications only when loader is completed so that |
800 // we don't fire them for fragment redirection that happens in window.onload | 800 // we don't fire them for fragment redirection that happens in window.onload |
801 // handler. See https://bugs.webkit.org/show_bug.cgi?id=31838 | 801 // handler. See https://bugs.webkit.org/show_bug.cgi?id=31838 |
802 if (m_frame->document()->loadEventFinished()) | 802 // Do not fire the notifications if the frame is concurrently navigating away |
| 803 // from the document, since a new document is already loading. |
| 804 if (m_frame->document()->loadEventFinished() && !m_provisionalDocumentLoader) |
803 client()->didStartLoading(NavigationWithinSameDocument); | 805 client()->didStartLoading(NavigationWithinSameDocument); |
804 | 806 |
805 HistoryCommitType historyCommitType = loadTypeToCommitType(type); | 807 HistoryCommitType historyCommitType = loadTypeToCommitType(type); |
806 if (!m_currentItem) | 808 if (!m_currentItem) |
807 historyCommitType = HistoryInertCommit; | 809 historyCommitType = HistoryInertCommit; |
808 if (m_frame->settings()->historyEntryRequiresUserGesture() && | 810 if (m_frame->settings()->historyEntryRequiresUserGesture() && |
809 initiatingDocument && !initiatingDocument->hasReceivedUserGesture()) { | 811 initiatingDocument && !initiatingDocument->hasReceivedUserGesture()) { |
810 historyCommitType = HistoryInertCommit; | 812 historyCommitType = HistoryInertCommit; |
811 } | 813 } |
812 | 814 |
813 setHistoryItemStateForCommit( | 815 setHistoryItemStateForCommit( |
814 type, historyCommitType, | 816 type, historyCommitType, |
815 sameDocumentNavigationSource == SameDocumentNavigationHistoryApi | 817 sameDocumentNavigationSource == SameDocumentNavigationHistoryApi |
816 ? HistoryNavigationType::HistoryApi | 818 ? HistoryNavigationType::HistoryApi |
817 : HistoryNavigationType::Fragment); | 819 : HistoryNavigationType::Fragment); |
818 if (sameDocumentNavigationSource == SameDocumentNavigationHistoryApi) { | 820 if (sameDocumentNavigationSource == SameDocumentNavigationHistoryApi) { |
819 m_currentItem->setStateObject(std::move(data)); | 821 m_currentItem->setStateObject(std::move(data)); |
820 m_currentItem->setScrollRestorationType(scrollRestorationType); | 822 m_currentItem->setScrollRestorationType(scrollRestorationType); |
821 } | 823 } |
822 client()->dispatchDidNavigateWithinPage( | 824 client()->dispatchDidNavigateWithinPage( |
823 m_currentItem.get(), historyCommitType, !!initiatingDocument); | 825 m_currentItem.get(), historyCommitType, !!initiatingDocument); |
824 client()->dispatchDidReceiveTitle(m_frame->document()->title()); | 826 client()->dispatchDidReceiveTitle(m_frame->document()->title()); |
825 if (m_frame->document()->loadEventFinished()) | 827 if (m_frame->document()->loadEventFinished() && !m_provisionalDocumentLoader) |
826 client()->didStopLoading(); | 828 client()->didStopLoading(); |
827 } | 829 } |
828 | 830 |
829 void FrameLoader::detachDocumentLoader(Member<DocumentLoader>& loader) { | 831 void FrameLoader::detachDocumentLoader(Member<DocumentLoader>& loader) { |
830 if (!loader) | 832 if (!loader) |
831 return; | 833 return; |
832 | 834 |
833 FrameNavigationDisabler navigationDisabler(*m_frame); | 835 FrameNavigationDisabler navigationDisabler(*m_frame); |
834 loader->detachFromFrame(); | 836 loader->detachFromFrame(); |
835 loader = nullptr; | 837 loader = nullptr; |
(...skipping 1114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1950 m_documentLoader ? m_documentLoader->url() : String()); | 1952 m_documentLoader ? m_documentLoader->url() : String()); |
1951 return tracedValue; | 1953 return tracedValue; |
1952 } | 1954 } |
1953 | 1955 |
1954 inline void FrameLoader::takeObjectSnapshot() const { | 1956 inline void FrameLoader::takeObjectSnapshot() const { |
1955 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, | 1957 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, |
1956 toTracedValue()); | 1958 toTracedValue()); |
1957 } | 1959 } |
1958 | 1960 |
1959 } // namespace blink | 1961 } // namespace blink |
OLD | NEW |