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-28 16:51:25 +01:00
Родитель 5db861cb4a
Коммит a8cf8ea9c3
1 изменённых файлов: 12 добавлений и 0 удалений

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

@ -346,6 +346,18 @@ 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);
if (uriWithPrin) {
nsCOMPtr<nsIPrincipal> uriPrin;
uriWithPrin->GetPrincipal(getter_AddRefs(uriPrin));
MOZ_ASSERT(uriPrin);
if (nsIPrincipal::Subsumes(uriPrin)) {
return NS_OK;
}
}
if (nsScriptSecurityManager::SecurityCompareURIs(mCodebase, aURI)) {
return NS_OK;
}