Bug 1422334. replaceState should update all the URI state for the entry being replaced. r=smaug
If we don't update the resultPrincipalURI, then things that examine it (e.g. Location APIs and the URL bar) will show the wrong (pre-replaceState) URL. I believe there is no effective difference between setting the result principal URI to null and setting it to aNewURI here: the ultimate consumer of it is NS_GetFinalChannelURI, which will fall back to the originalURI if it's null, and in this case the originalURI is aNewURI. Differential Revision: https://phabricator.services.mozilla.com/D41788
This commit is contained in:
@@ -11349,6 +11349,10 @@ nsresult nsDocShell::UpdateURLAndHistory(Document* aDocument, nsIURI* aNewURI,
|
||||
}
|
||||
newSHEntry->SetURI(aNewURI);
|
||||
newSHEntry->SetOriginalURI(aNewURI);
|
||||
// Setting the resultPrincipalURI to nullptr is fine here: it will cause
|
||||
// NS_GetFinalChannelURI to use the originalURI as the URI, which is aNewURI
|
||||
// in our case. We could also set it to aNewURI, with the same result.
|
||||
newSHEntry->SetResultPrincipalURI(nullptr);
|
||||
newSHEntry->SetLoadReplace(false);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user