Bug 1924861 - Only show the first history entry if it has user interaction. r=dom-core,omc-reviewers,sessionstore-reviewers,dao,peterv,tabbrowser-reviewers,mviar,sfoster
Differential Revision: https://phabricator.services.mozilla.com/D221390
This commit is contained in:
@@ -3075,7 +3075,8 @@ nsDocShell::GetCanGoBack(bool* aCanGoBack) {
|
||||
}
|
||||
RefPtr<ChildSHistory> rootSH = GetRootSessionHistory();
|
||||
if (rootSH) {
|
||||
*aCanGoBack = rootSH->CanGo(-1);
|
||||
*aCanGoBack = rootSH->CanGo(
|
||||
-1, StaticPrefs::browser_navigation_requireUserInteraction());
|
||||
MOZ_LOG(gSHLog, LogLevel::Verbose,
|
||||
("nsDocShell %p CanGoBack()->%d", this, *aCanGoBack));
|
||||
|
||||
@@ -3084,6 +3085,24 @@ nsDocShell::GetCanGoBack(bool* aCanGoBack) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::GetCanGoBackIgnoringUserInteraction(bool* aCanGoBack) {
|
||||
*aCanGoBack = false;
|
||||
if (!IsNavigationAllowed(false)) {
|
||||
return NS_OK; // JS may not handle returning of an error code
|
||||
}
|
||||
RefPtr<ChildSHistory> rootSH = GetRootSessionHistory();
|
||||
if (rootSH) {
|
||||
*aCanGoBack = rootSH->CanGo(-1, false);
|
||||
MOZ_LOG(gSHLog, LogLevel::Verbose,
|
||||
("nsDocShell %p CanGoBackIgnoringUserInteraction()->%d", this,
|
||||
*aCanGoBack));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::GetCanGoForward(bool* aCanGoForward) {
|
||||
*aCanGoForward = false;
|
||||
@@ -3092,7 +3111,8 @@ nsDocShell::GetCanGoForward(bool* aCanGoForward) {
|
||||
}
|
||||
RefPtr<ChildSHistory> rootSH = GetRootSessionHistory();
|
||||
if (rootSH) {
|
||||
*aCanGoForward = rootSH->CanGo(1);
|
||||
*aCanGoForward = rootSH->CanGo(
|
||||
1, StaticPrefs::browser_navigation_requireUserInteraction());
|
||||
MOZ_LOG(gSHLog, LogLevel::Verbose,
|
||||
("nsDocShell %p CanGoForward()->%d", this, *aCanGoForward));
|
||||
return NS_OK;
|
||||
|
||||
Reference in New Issue
Block a user