mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-03 05:47:29 +09:00
Issue #1118 Part 4: Allow UpdateURLAndHistory to work even if there's no
root session history. This can happen when someone does a document.open() on a document that has no session history.
This commit is contained in:
parent
08c26a9adf
commit
ab6131d1e6
1 changed files with 17 additions and 13 deletions
|
|
@ -12137,7 +12137,9 @@ nsDocShell::UpdateURLAndHistory(nsIDocument* aDocument, nsIURI* aNewURI,
|
||||||
// indicating that we're doing a pushState rather than a replaceState, notify
|
// indicating that we're doing a pushState rather than a replaceState, notify
|
||||||
// bfcache that we've added a page to the history so it can evict content
|
// bfcache that we've added a page to the history so it can evict content
|
||||||
// viewers if appropriate. Otherwise call ReplaceEntry so that we notify
|
// viewers if appropriate. Otherwise call ReplaceEntry so that we notify
|
||||||
// nsIHistoryListeners that an entry was replaced.
|
// nsIHistoryListeners that an entry was replaced. We may not have a root
|
||||||
|
// session history if this call is coming from a document.open() in a docshell
|
||||||
|
// subtree that disables session history.
|
||||||
nsCOMPtr<nsISHistory> rootSH;
|
nsCOMPtr<nsISHistory> rootSH;
|
||||||
GetRootSessionHistory(getter_AddRefs(rootSH));
|
GetRootSessionHistory(getter_AddRefs(rootSH));
|
||||||
NS_ENSURE_TRUE(rootSH, NS_ERROR_UNEXPECTED);
|
NS_ENSURE_TRUE(rootSH, NS_ERROR_UNEXPECTED);
|
||||||
|
|
@ -12147,19 +12149,21 @@ nsDocShell::UpdateURLAndHistory(nsIDocument* aDocument, nsIURI* aNewURI,
|
||||||
|
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
|
||||||
if (!aReplace) {
|
if (rootSH) {
|
||||||
int32_t curIndex = -1;
|
if (!aReplace) {
|
||||||
rv = rootSH->GetIndex(&curIndex);
|
int32_t curIndex = -1;
|
||||||
if (NS_SUCCEEDED(rv) && curIndex > -1) {
|
rv = rootSH->GetIndex(&curIndex);
|
||||||
internalSH->EvictOutOfRangeContentViewers(curIndex);
|
if (NS_SUCCEEDED(rv) && curIndex > -1) {
|
||||||
}
|
internalSH->EvictOutOfRangeContentViewers(curIndex);
|
||||||
} else {
|
}
|
||||||
nsCOMPtr<nsISHEntry> rootSHEntry = GetRootSHEntry(newSHEntry);
|
} else {
|
||||||
|
nsCOMPtr<nsISHEntry> rootSHEntry = GetRootSHEntry(newSHEntry);
|
||||||
|
|
||||||
int32_t index = -1;
|
int32_t index = -1;
|
||||||
rv = rootSH->GetIndexOfEntry(rootSHEntry, &index);
|
rv = rootSH->GetIndexOfEntry(rootSHEntry, &index);
|
||||||
if (NS_SUCCEEDED(rv) && index > -1) {
|
if (NS_SUCCEEDED(rv) && index > -1) {
|
||||||
internalSH->ReplaceEntry(index, rootSHEntry);
|
internalSH->ReplaceEntry(index, rootSHEntry);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue