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

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

Issue 2780953002: When historyEntryRequiresUserGesture is enabled, exempt docs that have been committed for 5 seconds (Closed)
Patch Set: Centralize checking the setting Created 3 years, 8 months 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 696 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 // we don't fire them for fragment redirection that happens in window.onload 707 // we don't fire them for fragment redirection that happens in window.onload
708 // handler. See https://bugs.webkit.org/show_bug.cgi?id=31838 708 // handler. See https://bugs.webkit.org/show_bug.cgi?id=31838
709 // Do not fire the notifications if the frame is concurrently navigating away 709 // Do not fire the notifications if the frame is concurrently navigating away
710 // from the document, since a new document is already loading. 710 // from the document, since a new document is already loading.
711 if (m_frame->document()->loadEventFinished() && !m_provisionalDocumentLoader) 711 if (m_frame->document()->loadEventFinished() && !m_provisionalDocumentLoader)
712 client()->didStartLoading(NavigationWithinSameDocument); 712 client()->didStartLoading(NavigationWithinSameDocument);
713 713
714 HistoryCommitType historyCommitType = loadTypeToCommitType(type); 714 HistoryCommitType historyCommitType = loadTypeToCommitType(type);
715 if (!m_currentItem) 715 if (!m_currentItem)
716 historyCommitType = HistoryInertCommit; 716 historyCommitType = HistoryInertCommit;
717 if (m_frame->settings()->getHistoryEntryRequiresUserGesture() && 717 if (initiatingDocument && !initiatingDocument->canCreateHistoryEntry()) {
718 initiatingDocument &&
719 !initiatingDocument->frame()->hasReceivedUserGesture()) {
720 historyCommitType = HistoryInertCommit; 718 historyCommitType = HistoryInertCommit;
721 } 719 }
722 720
723 setHistoryItemStateForCommit( 721 setHistoryItemStateForCommit(
724 type, historyCommitType, 722 type, historyCommitType,
725 sameDocumentNavigationSource == SameDocumentNavigationHistoryApi 723 sameDocumentNavigationSource == SameDocumentNavigationHistoryApi
726 ? HistoryNavigationType::HistoryApi 724 ? HistoryNavigationType::HistoryApi
727 : HistoryNavigationType::Fragment); 725 : HistoryNavigationType::Fragment);
728 if (sameDocumentNavigationSource == SameDocumentNavigationHistoryApi) { 726 if (sameDocumentNavigationSource == SameDocumentNavigationHistoryApi) {
729 m_currentItem->setStateObject(std::move(data)); 727 m_currentItem->setStateObject(std::move(data));
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 if (!request.originDocument()) 851 if (!request.originDocument())
854 return FrameLoadTypeReload; 852 return FrameLoadTypeReload;
855 return FrameLoadTypeReplaceCurrentItem; 853 return FrameLoadTypeReplaceCurrentItem;
856 } 854 }
857 855
858 if (request.substituteData().failingURL() == 856 if (request.substituteData().failingURL() ==
859 m_documentLoader->urlForHistory() && 857 m_documentLoader->urlForHistory() &&
860 m_documentLoader->loadType() == FrameLoadTypeReload) 858 m_documentLoader->loadType() == FrameLoadTypeReload)
861 return FrameLoadTypeReload; 859 return FrameLoadTypeReload;
862 860
863 if (m_frame->settings()->getHistoryEntryRequiresUserGesture() && 861 if (request.originDocument() &&
864 request.originDocument() && 862 !request.originDocument()->canCreateHistoryEntry())
865 !request.originDocument()->frame()->hasReceivedUserGesture())
866 return FrameLoadTypeReplaceCurrentItem; 863 return FrameLoadTypeReplaceCurrentItem;
867 864
868 return FrameLoadTypeStandard; 865 return FrameLoadTypeStandard;
869 } 866 }
870 867
871 bool FrameLoader::prepareRequestForThisFrame(FrameLoadRequest& request) { 868 bool FrameLoader::prepareRequestForThisFrame(FrameLoadRequest& request) {
872 // If no origin Document* was specified, skip remaining security checks and 869 // If no origin Document* was specified, skip remaining security checks and
873 // assume the caller has fully initialized the FrameLoadRequest. 870 // assume the caller has fully initialized the FrameLoadRequest.
874 if (!request.originDocument()) 871 if (!request.originDocument())
875 return true; 872 return true;
(...skipping 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after
1901 frameLoadRequest.clientRedirect()); 1898 frameLoadRequest.clientRedirect());
1902 1899
1903 loader->setLoadType(loadType); 1900 loader->setLoadType(loadType);
1904 loader->setNavigationType(navigationType); 1901 loader->setNavigationType(navigationType);
1905 loader->setReplacesCurrentHistoryItem(loadType == 1902 loader->setReplacesCurrentHistoryItem(loadType ==
1906 FrameLoadTypeReplaceCurrentItem); 1903 FrameLoadTypeReplaceCurrentItem);
1907 return loader; 1904 return loader;
1908 } 1905 }
1909 1906
1910 } // namespace blink 1907 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698