Bug 1105556 - Call Create(originAttributes) when loadinfo->loadingPrincipal is null, instead of CreatePrincipalWithInheritedAttributes(). r=sicking

This commit is contained in:
Tanvi Vyas
2016-04-13 16:30:22 -07:00
parent f529b904eb
commit d0fb122eb2
2 changed files with 27 additions and 6 deletions

View File

@@ -12048,9 +12048,20 @@ nsDocShell::AddToSessionHistory(nsIURI* aURI, nsIChannel* aChannel,
if (loadInfo) {
// For now keep storing just the principal in the SHEntry.
if (loadInfo->GetLoadingSandboxed()) {
owner = nsNullPrincipal::CreateWithInheritedAttributes(
loadInfo->LoadingPrincipal());
NS_ENSURE_TRUE(owner, NS_ERROR_FAILURE);
if (loadInfo->LoadingPrincipal()) {
owner = nsNullPrincipal::CreateWithInheritedAttributes(
loadInfo->LoadingPrincipal());
NS_ENSURE_TRUE(owner, NS_ERROR_FAILURE);
} else {
// get the OriginAttributes
NeckoOriginAttributes nAttrs;
loadInfo->GetOriginAttributes(&nAttrs);
PrincipalOriginAttributes pAttrs;
pAttrs.InheritFromNecko(nAttrs);
owner = nsNullPrincipal::Create(pAttrs);
NS_ENSURE_TRUE(owner, NS_ERROR_FAILURE);
}
} else if (loadInfo->GetForceInheritPrincipal()) {
owner = loadInfo->TriggeringPrincipal();
}