Bug 1173215, don't set mChromeXHRDocURI when dealing with non-XHR documents, r=bz

This commit is contained in:
Olli Pettay 2015-06-13 02:34:52 +03:00
parent 7df644735f
commit a578f63d48
3 changed files with 11 additions and 4 deletions

View File

@ -2277,7 +2277,7 @@ nsDocument::Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup)
NS_GET_IID(nsIURI), getter_AddRefs(baseURI));
if (baseURI) {
mDocumentBaseURI = baseURI;
mChromeXHRDocBaseURI = baseURI;
mChromeXHRDocBaseURI = nullptr;
}
}
@ -2359,7 +2359,7 @@ nsDocument::ResetToURI(nsIURI *aURI, nsILoadGroup *aLoadGroup,
mOriginalURI = nullptr;
SetDocumentURI(aURI);
mChromeXHRDocURI = aURI;
mChromeXHRDocURI = nullptr;
// If mDocumentBaseURI is null, nsIDocument::GetBaseURI() returns
// mDocumentURI.
mDocumentBaseURI = nullptr;

View File

@ -486,6 +486,14 @@ function runTest() {
xhr.send();
yield undefined;
history.pushState({}, "pushStateTest", window.location.href + "/pushStateTest");
ok(document.documentURI.indexOf("pushStateTest") > -1);
var chromeDoc = SpecialPowers.wrap(document);
ok(chromeDoc.documentURI.indexOf("pushStateTest") > -1);
history.back();
SimpleTest.finish();
SpecialPowers.removePermission("systemXHR", document);
yield undefined;

View File

@ -175,10 +175,9 @@ SetBaseURIUsingFirstBaseWithHref(nsIDocument* aDocument, nsIContent* aMustMatch)
// Try to set our base URI. If that fails, try to set base URI to null
nsresult rv = aDocument->SetBaseURI(newBaseURI);
aDocument->SetChromeXHRDocBaseURI(newBaseURI);
aDocument->SetChromeXHRDocBaseURI(nullptr);
if (NS_FAILED(rv)) {
aDocument->SetBaseURI(nullptr);
aDocument->SetChromeXHRDocBaseURI(nullptr);
}
return;
}