Removed the GetCanGoBack and GetCanGoForward calls from GoBack and GoForward respectively. The session history calls to get the next and previous entry will properly return error codes if navigtion in the desired direction isn't possible.
This commit is contained in:
@@ -976,12 +976,6 @@ NS_IMETHODIMP nsDocShell::GoBack()
|
||||
}
|
||||
|
||||
NS_ENSURE_STATE(mSessionHistory);
|
||||
|
||||
PRBool canGoBack = PR_FALSE;
|
||||
GetCanGoBack(&canGoBack);
|
||||
NS_ENSURE_TRUE(canGoBack, NS_ERROR_UNEXPECTED);
|
||||
|
||||
UpdateCurrentSessionHistory();
|
||||
|
||||
nsCOMPtr<nsISHEntry> previousEntry;
|
||||
|
||||
@@ -989,6 +983,8 @@ NS_IMETHODIMP nsDocShell::GoBack()
|
||||
getter_AddRefs(previousEntry)), NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(previousEntry, NS_ERROR_FAILURE);
|
||||
|
||||
UpdateCurrentSessionHistory();
|
||||
|
||||
NS_ENSURE_SUCCESS(LoadHistoryEntry(previousEntry), NS_ERROR_FAILURE);
|
||||
|
||||
return NS_OK;
|
||||
@@ -1006,18 +1002,14 @@ NS_IMETHODIMP nsDocShell::GoForward()
|
||||
|
||||
NS_ENSURE_STATE(mSessionHistory);
|
||||
|
||||
PRBool canGoForward = PR_FALSE;
|
||||
GetCanGoForward(&canGoForward);
|
||||
NS_ENSURE_TRUE(canGoForward, NS_ERROR_UNEXPECTED);
|
||||
|
||||
UpdateCurrentSessionHistory();
|
||||
|
||||
nsCOMPtr<nsISHEntry> nextEntry;
|
||||
|
||||
NS_ENSURE_SUCCESS(mSessionHistory->GetNextEntry(PR_TRUE,
|
||||
getter_AddRefs(nextEntry)), NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(nextEntry, NS_ERROR_FAILURE);
|
||||
|
||||
UpdateCurrentSessionHistory();
|
||||
|
||||
NS_ENSURE_SUCCESS(LoadHistoryEntry(nextEntry), NS_ERROR_FAILURE);
|
||||
|
||||
return NS_OK;
|
||||
|
||||
Reference in New Issue
Block a user