Bug 1577298 - Do not stop at the current document when computing the top-level principal for storage partitioning; r=baku

Differential Revision: https://phabricator.services.mozilla.com/D47339
This commit is contained in:
Ehsan Akhgari
2019-09-27 14:05:13 +00:00
parent da3a69b117
commit 772d7644fd
17 changed files with 328 additions and 10 deletions

View File

@@ -271,6 +271,15 @@ nsScriptSecurityManager::GetChannelResultPrincipals(
return rv;
}
if (!(*aPrincipal)->GetIsContentPrincipal()) {
// If for some reason we don't have a content principal here, just reuse our
// principal for the storage principal too, since attempting to create a
// storage principal would fail anyway.
nsCOMPtr<nsIPrincipal> copy = *aPrincipal;
copy.forget(aStoragePrincipal);
return NS_OK;
}
return StoragePrincipalHelper::Create(aChannel, *aPrincipal,
aStoragePrincipal);
}