зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1105556 - Call Create(originAttributes) when loadinfo->loadingPrincipal is null, instead of CreatePrincipalWithInheritedAttributes(). r=sicking
This commit is contained in:
Родитель
1e5f23269c
Коммит
c73e96a53d
|
@ -344,9 +344,19 @@ nsScriptSecurityManager::GetChannelResultPrincipal(nsIChannel* aChannel,
|
|||
aChannel->GetLoadInfo(getter_AddRefs(loadInfo));
|
||||
if (loadInfo) {
|
||||
if (loadInfo->GetLoadingSandboxed()) {
|
||||
RefPtr<nsNullPrincipal> prin =
|
||||
nsNullPrincipal::CreateWithInheritedAttributes(loadInfo->LoadingPrincipal());
|
||||
NS_ENSURE_TRUE(prin, NS_ERROR_FAILURE);
|
||||
RefPtr<nsNullPrincipal> prin;
|
||||
if (loadInfo->LoadingPrincipal()) {
|
||||
prin =
|
||||
nsNullPrincipal::CreateWithInheritedAttributes(loadInfo->LoadingPrincipal());
|
||||
NS_ENSURE_TRUE(prin, NS_ERROR_FAILURE);
|
||||
} else {
|
||||
NeckoOriginAttributes nAttrs;
|
||||
loadInfo->GetOriginAttributes(&nAttrs);
|
||||
PrincipalOriginAttributes pAttrs;
|
||||
pAttrs.InheritFromNecko(nAttrs);
|
||||
prin = nsNullPrincipal::Create(pAttrs);
|
||||
NS_ENSURE_TRUE(prin, NS_ERROR_FAILURE);
|
||||
}
|
||||
prin.forget(aPrincipal);
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче