From 108dd29bbc146e823e18d572ed8c7432db230d63 Mon Sep 17 00:00:00 2001 From: Peter Van der Beken Date: Wed, 13 Mar 2024 10:56:33 +0000 Subject: [PATCH] Bug 1883279 - Check browser.navigation.requireUserInteraction before skipping entries based on user interaction. r=farre We don't want to start skipping entries just because callers passed in aRequireUserInteraction, since the feature is not ready and the flag in the entries might not be correct. Differential Revision: https://phabricator.services.mozilla.com/D203376 --- docshell/base/CanonicalBrowsingContext.cpp | 3 ++- docshell/shistory/ChildSHistory.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docshell/base/CanonicalBrowsingContext.cpp b/docshell/base/CanonicalBrowsingContext.cpp index 3636d4a0e2f0..84f2d2960a3f 100644 --- a/docshell/base/CanonicalBrowsingContext.cpp +++ b/docshell/base/CanonicalBrowsingContext.cpp @@ -1220,7 +1220,8 @@ Maybe CanonicalBrowsingContext::HistoryGo( // Check for user interaction if desired, except for the first and last // history entries. We compare with >= to account for the case where // aOffset >= length. - if (!aRequireUserInteraction || index.value() >= shistory->Length() - 1 || + if (!StaticPrefs::browser_navigation_requireUserInteraction() || + !aRequireUserInteraction || index.value() >= shistory->Length() - 1 || index.value() <= 0) { break; } diff --git a/docshell/shistory/ChildSHistory.cpp b/docshell/shistory/ChildSHistory.cpp index 91484917181e..3e3cf09493d7 100644 --- a/docshell/shistory/ChildSHistory.cpp +++ b/docshell/shistory/ChildSHistory.cpp @@ -156,7 +156,8 @@ void ChildSHistory::Go(int32_t aOffset, bool aRequireUserInteraction, // Check for user interaction if desired, except for the first and last // history entries. We compare with >= to account for the case where // aOffset >= Count(). - if (!aRequireUserInteraction || index.value() >= Count() - 1 || + if (!StaticPrefs::browser_navigation_requireUserInteraction() || + !aRequireUserInteraction || index.value() >= Count() - 1 || index.value() <= 0) { break; }