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

Unified Diff: third_party/WebKit/Source/core/loader/FrameLoader.cpp

Issue 2323563002: Add a flag to require a user gesture to add an entry to the back/forward list. (Closed)
Patch Set: Rebase Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/frame/Settings.in ('k') | third_party/WebKit/Source/web/WebSettingsImpl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/loader/FrameLoader.cpp
diff --git a/third_party/WebKit/Source/core/loader/FrameLoader.cpp b/third_party/WebKit/Source/core/loader/FrameLoader.cpp
index 960bd1483826cb4ab9eb6983fa2f08140d4a4510..90574479069ec7ec4aac7639d9ba9f2424b14b97 100644
--- a/third_party/WebKit/Source/core/loader/FrameLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/FrameLoader.cpp
@@ -374,6 +374,9 @@ void FrameLoader::clearProvisionalHistoryItem()
void FrameLoader::setHistoryItemStateForCommit(FrameLoadType loadType, HistoryCommitType historyCommitType, HistoryNavigationType navigationType)
{
+ if (m_frame->settings()->historyEntryRequiresUserGesture() && historyCommitType == StandardCommit)
+ UserGestureIndicator::clearProcessedUserGestureSinceLoad();
+
HistoryItem* oldItem = m_currentItem;
if (isBackForwardLoadType(loadType) && m_provisionalItem)
m_currentItem = m_provisionalItem.release();
@@ -725,6 +728,8 @@ void FrameLoader::updateForSameDocumentNavigation(const KURL& newURL, SameDocume
HistoryCommitType historyCommitType = loadTypeToCommitType(type);
if (!m_currentItem)
historyCommitType = HistoryInertCommit;
+ if (m_frame->settings()->historyEntryRequiresUserGesture() && !UserGestureIndicator::processedUserGestureSinceLoad() && initiatingDocument)
+ historyCommitType = HistoryInertCommit;
setHistoryItemStateForCommit(type, historyCommitType, sameDocumentNavigationSource == SameDocumentNavigationHistoryApi ? HistoryNavigationType::HistoryApi : HistoryNavigationType::Fragment);
if (sameDocumentNavigationSource == SameDocumentNavigationHistoryApi) {
@@ -838,6 +843,10 @@ FrameLoadType FrameLoader::determineFrameLoadType(const FrameLoadRequest& reques
if (request.substituteData().failingURL() == m_documentLoader->urlForHistory() && m_loadType == FrameLoadTypeReload)
return FrameLoadTypeReload;
+
+ if (m_frame->settings()->historyEntryRequiresUserGesture() && !UserGestureIndicator::processedUserGestureSinceLoad() && request.originDocument())
+ return FrameLoadTypeReplaceCurrentItem;
+
return FrameLoadTypeStandard;
}
« no previous file with comments | « third_party/WebKit/Source/core/frame/Settings.in ('k') | third_party/WebKit/Source/web/WebSettingsImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698