Bug 1088617 - Handle nsIURIWithPrincipal in nsPrincipal::CheckMayLoad. r=bz

This mimics the logic already inside nsNullPrincipal::CheckMayLoad.
This commit is contained in:
Bobby Holley 2014-10-29 09:21:17 +01:00
Родитель 049c6364b8
Коммит f53e1888e0
1 изменённых файлов: 11 добавлений и 0 удалений

Просмотреть файл

@ -346,6 +346,17 @@ nsPrincipal::CheckMayLoad(nsIURI* aURI, bool aReport, bool aAllowIfInheritsPrinc
}
}
// See if aURI is something like a Blob URI that is actually associated with
// a principal.
nsCOMPtr<nsIURIWithPrincipal> uriWithPrin = do_QueryInterface(aURI);
nsCOMPtr<nsIPrincipal> uriPrin;
if (uriWithPrin) {
uriWithPrin->GetPrincipal(getter_AddRefs(uriPrin));
}
if (uriPrin && nsIPrincipal::Subsumes(uriPrin)) {
return NS_OK;
}
if (nsScriptSecurityManager::SecurityCompareURIs(mCodebase, aURI)) {
return NS_OK;
}