Finally kill off CheckSameOriginPrincipal, fix remaining callers to do the
checks they really want to be doing. Fix screw-up in nsPrincipal::Equals if one principal has a cert and the other does not. Bug 418996, r=mrbkap,dveditz, sr=jst git-svn-id: svn://10.0.0.236/trunk@248133 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -726,16 +726,6 @@ nsScriptSecurityManager::CheckSameOriginURI(nsIURI* aSourceURI,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsScriptSecurityManager::CheckSameOriginPrincipal(nsIPrincipal* aSourcePrincipal,
|
||||
nsIPrincipal* aTargetPrincipal)
|
||||
{
|
||||
return CheckSameOriginPrincipalInternal(aSourcePrincipal,
|
||||
aTargetPrincipal,
|
||||
PR_FALSE);
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsScriptSecurityManager::CheckPropertyAccessImpl(PRUint32 aAction,
|
||||
nsAXPCNativeCallContext* aCallContext,
|
||||
@@ -962,10 +952,11 @@ nsScriptSecurityManager::CheckPropertyAccessImpl(PRUint32 aAction,
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* static */
|
||||
nsresult
|
||||
nsScriptSecurityManager::CheckSameOriginPrincipalInternal(nsIPrincipal* aSubject,
|
||||
nsIPrincipal* aObject,
|
||||
PRBool aIsCheckConnect)
|
||||
nsScriptSecurityManager::CheckSameOriginPrincipal(nsIPrincipal* aSubject,
|
||||
nsIPrincipal* aObject,
|
||||
PRBool aIsCheckConnect)
|
||||
{
|
||||
/*
|
||||
** Get origin of subject and object and compare.
|
||||
@@ -1035,8 +1026,19 @@ nsScriptSecurityManager::CheckSameOriginDOMProp(nsIPrincipal* aSubject,
|
||||
PRUint32 aAction,
|
||||
PRBool aIsCheckConnect)
|
||||
{
|
||||
nsresult rv = CheckSameOriginPrincipalInternal(aSubject, aObject,
|
||||
aIsCheckConnect);
|
||||
nsresult rv;
|
||||
if (aIsCheckConnect) {
|
||||
// Don't do equality compares, just do a same-origin compare,
|
||||
// since the object principal isn't a real principal, just a
|
||||
// GetCodebasePrincipal() on whatever URI we started with.
|
||||
rv = CheckSameOriginPrincipal(aSubject, aObject, aIsCheckConnect);
|
||||
} else {
|
||||
PRBool subsumes;
|
||||
rv = aSubject->Subsumes(aObject, &subsumes);
|
||||
if (NS_SUCCEEDED(rv) && !subsumes) {
|
||||
rv = NS_ERROR_DOM_PROP_ACCESS_DENIED;
|
||||
}
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
return NS_OK;
|
||||
@@ -1696,9 +1698,12 @@ nsScriptSecurityManager::CheckFunctionAccess(JSContext *aCx, void *aFunObj,
|
||||
if (!object)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// Note that CheckSameOriginPrincipalInternal already does an equality
|
||||
// comparison on subject and object, so no need for us to do it.
|
||||
return CheckSameOriginPrincipalInternal(subject, object, PR_TRUE);
|
||||
PRBool subsumes;
|
||||
rv = subject->Subsumes(object, &subsumes);
|
||||
if (NS_SUCCEEDED(rv) && !subsumes) {
|
||||
rv = NS_ERROR_DOM_PROP_ACCESS_DENIED;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
||||
Reference in New Issue
Block a user