Bug 210601 - XSLT should check whether the subject principal is the system principal.

r=axel@pike.org sr=jst@netscape.com
This commit is contained in:
caillon%returnzero.com 2005-11-02 07:40:52 +00:00
parent d0e32612b0
commit ddb1136ea6

View File

@ -215,6 +215,20 @@ PRBool URIUtils::CanCallerAccess(nsIDOMNode *aNode)
return PR_TRUE;
}
// Check whether the subject principal is the system principal.
// For performance, we will avoid calling SubjectPrincipalIsChrome()
// since it calls GetSubjectPrincipal() which causes us to walk
// the JS frame stack. We already did that above, so just get the
// system principal from the security manager, and do a raw comparison.
nsCOMPtr<nsIPrincipal> systemPrincipal;
gTxSecurityManager->GetSystemPrincipal(getter_AddRefs(systemPrincipal));
if (subjectPrincipal == systemPrincipal) {
// we're running as system, grant access to the node.
return PR_TRUE;
}
// Make sure that this is a real node. We do this by first QI'ing to
// nsIContent (which is important performance wise) and if that QI
// fails we QI to nsIDocument. If both those QI's fail we won't let