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