Bug 447579. Be a little more careful about inheriting principals for file URIs. r=dveditz, sr=jst, a=dveditz

git-svn-id: svn://10.0.0.236/trunk@254179 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
bzbarsky%mit.edu 2008-09-12 13:34:20 +00:00
parent 457799fee2
commit aa29b444fd

View File

@ -7462,8 +7462,18 @@ nsDocShell::DoURILoad(nsIURI * aURI,
nsCOMPtr<nsIPrincipal> ownerPrincipal(do_QueryInterface(aOwner)); nsCOMPtr<nsIPrincipal> ownerPrincipal(do_QueryInterface(aOwner));
if (URIIsLocalFile(aURI) && ownerPrincipal && if (URIIsLocalFile(aURI) && ownerPrincipal &&
NS_SUCCEEDED(ownerPrincipal->CheckMayLoad(aURI, PR_FALSE))) { NS_SUCCEEDED(ownerPrincipal->CheckMayLoad(aURI, PR_FALSE))) {
// One more check here. CheckMayLoad will always return true for the
// system principal, but we do NOT want to inherit in that case.
PRBool isSystem;
nsCOMPtr<nsIScriptSecurityManager> secMan =
do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID);
if (secMan &&
NS_SUCCEEDED(secMan->IsSystemPrincipal(ownerPrincipal,
&isSystem)) &&
!isSystem) {
channel->SetOwner(aOwner); channel->SetOwner(aOwner);
} }
}
nsCOMPtr<nsIScriptChannel> scriptChannel = do_QueryInterface(channel); nsCOMPtr<nsIScriptChannel> scriptChannel = do_QueryInterface(channel);
if (scriptChannel) { if (scriptChannel) {