Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(171)

Side by Side Diff: third_party/WebKit/Source/core/loader/FrameLoader.cpp

Issue 2475693002: Do not reset NavigationHandle when navigating same-page (Closed)
Patch Set: Rebase Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 navigating away from the
801 // document, since a new document is already loading.
Charlie Reis 2016/11/04 17:30:53 nit: concurrently navigating away
clamy 2016/11/07 14:10:51 Done.
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 1111 matching lines...) Expand 10 before | Expand all | Expand 10 after
1945 m_documentLoader ? m_documentLoader->url() : String()); 1947 m_documentLoader ? m_documentLoader->url() : String());
1946 return tracedValue; 1948 return tracedValue;
1947 } 1949 }
1948 1950
1949 inline void FrameLoader::takeObjectSnapshot() const { 1951 inline void FrameLoader::takeObjectSnapshot() const {
1950 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, 1952 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this,
1951 toTracedValue()); 1953 toTracedValue());
1952 } 1954 }
1953 1955
1954 } // namespace blink 1956 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698