mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 19:35:51 +00:00
Bug 623436 - Deal a little better with replacing inexistant session history entries. r=smaug
--HG-- extra : source : 20c734f8107e43e15ae11abae1d6a6e985510d93
This commit is contained in:
parent
c067786818
commit
8aeb3f91d9
@ -12275,17 +12275,25 @@ nsDocShell::AddToSessionHistory(nsIURI* aURI, nsIChannel* aChannel,
|
||||
}
|
||||
|
||||
// This is the root docshell
|
||||
if (LOAD_TYPE_HAS_FLAGS(mLoadType, LOAD_FLAGS_REPLACE_HISTORY)) {
|
||||
bool addToSHistory = !LOAD_TYPE_HAS_FLAGS(mLoadType, LOAD_FLAGS_REPLACE_HISTORY);
|
||||
if (!addToSHistory) {
|
||||
// Replace current entry in session history.
|
||||
int32_t index = 0;
|
||||
mSessionHistory->GetIndex(&index);
|
||||
nsCOMPtr<nsISHistoryInternal> shPrivate =
|
||||
do_QueryInterface(mSessionHistory);
|
||||
// Replace the current entry with the new entry
|
||||
if (shPrivate) {
|
||||
rv = shPrivate->ReplaceEntry(index, entry);
|
||||
if (index >= 0) {
|
||||
if (shPrivate) {
|
||||
rv = shPrivate->ReplaceEntry(index, entry);
|
||||
}
|
||||
} else {
|
||||
// If we're trying to replace an inexistant shistory entry, append.
|
||||
addToSHistory = true;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
|
||||
if (addToSHistory) {
|
||||
// Add to session history
|
||||
nsCOMPtr<nsISHistoryInternal> shPrivate =
|
||||
do_QueryInterface(mSessionHistory);
|
||||
|
Loading…
Reference in New Issue
Block a user