mirror of
https://github.com/roytam1/UXP.git
synced 2026-05-26 14:54:25 +00:00
Issue #1118 Part 2: Allow UpdateURLAndHistory to work even if mOSHE is
null, if we're doing a replace. We're going to end up hitting this if someone does a document.open() before mOSHE has been set. We shouldn't need to worry about mLSHE, because the document.open() will cancel the corresponding load.
This commit is contained in:
@@ -12054,7 +12054,7 @@ nsDocShell::UpdateURLAndHistory(nsIDocument* aDocument, nsIURI* aNewURI,
|
||||
// history. This will erase all SHEntries after the new entry and make this
|
||||
// entry the current one. This operation may modify mOSHE, which we need
|
||||
// later, so we keep a reference here.
|
||||
NS_ENSURE_TRUE(mOSHE, NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(mOSHE || aReplace, NS_ERROR_FAILURE);
|
||||
nsCOMPtr<nsISHEntry> oldOSHE = mOSHE;
|
||||
|
||||
mLoadType = LOAD_PUSHSTATE;
|
||||
@@ -12101,6 +12101,16 @@ nsDocShell::UpdateURLAndHistory(nsIDocument* aDocument, nsIURI* aNewURI,
|
||||
} else {
|
||||
// Step 3.
|
||||
newSHEntry = mOSHE;
|
||||
|
||||
// Since we're not changing which page we have loaded, pass
|
||||
if (!newSHEntry) {
|
||||
nsresult rv = AddToSessionHistory(
|
||||
aNewURI, nullptr,
|
||||
aDocument->NodePrincipal(), // triggeringPrincipal
|
||||
nullptr, true, getter_AddRefs(newSHEntry));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
mOSHE = newSHEntry;
|
||||
}
|
||||
newSHEntry->SetURI(aNewURI);
|
||||
newSHEntry->SetOriginalURI(aNewURI);
|
||||
newSHEntry->SetLoadReplace(false);
|
||||
@@ -12117,7 +12127,10 @@ nsDocShell::UpdateURLAndHistory(nsIDocument* aDocument, nsIURI* aNewURI,
|
||||
// set URIWasModified to true for the current SHEntry (bug 669671).
|
||||
bool sameExceptHashes = true, oldURIWasModified = false;
|
||||
aNewURI->EqualsExceptRef(aCurrentURI, &sameExceptHashes);
|
||||
oldOSHE->GetURIWasModified(&oldURIWasModified);
|
||||
// mOSHE might be null on replace. Only check if we're not replacing.
|
||||
if (oldOSHE) {
|
||||
oldOSHE->GetURIWasModified(&oldURIWasModified);
|
||||
}
|
||||
newSHEntry->SetURIWasModified(!sameExceptHashes || oldURIWasModified);
|
||||
|
||||
// Step E as described at the top of AddState: If aReplace is false,
|
||||
|
||||
Reference in New Issue
Block a user