mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 14:22:01 +00:00
Bug 447579. Be a little more careful about inheriting principals for file URIs. r=dveditz, sr=jst
This commit is contained in:
parent
5863cb9ef2
commit
151a371207
@ -7476,8 +7476,18 @@ nsDocShell::DoURILoad(nsIURI * aURI,
|
||||
nsCOMPtr<nsIPrincipal> ownerPrincipal(do_QueryInterface(aOwner));
|
||||
if (URIIsLocalFile(aURI) && ownerPrincipal &&
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIScriptChannel> scriptChannel = do_QueryInterface(channel);
|
||||
if (scriptChannel) {
|
||||
|
Loading…
Reference in New Issue
Block a user