Fixing crashes during tests by null-checking the principal URI as appropriate. Bug 495176

This commit is contained in:
Boris Zbarsky 2009-07-26 23:21:01 -04:00
parent 71e7b160c0
commit 123cf2cf60

View File

@ -842,6 +842,9 @@ nsScriptSecurityManager::CheckPropertyAccessImpl(PRUint32 aAction,
if (!nsAutoInPrincipalDomainOriginSetter::sInPrincipalDomainOrigin) {
nsCOMPtr<nsIURI> uri, domain;
subjectPrincipal->GetURI(getter_AddRefs(uri));
// Subject can't be system if we failed the security
// check, so |uri| is non-null.
NS_ASSERTION(uri, "How did that happen?");
GetOriginFromURI(uri, subjectOrigin);
subjectPrincipal->GetDomain(getter_AddRefs(domain));
if (domain) {
@ -859,7 +862,9 @@ nsScriptSecurityManager::CheckPropertyAccessImpl(PRUint32 aAction,
objectPrincipal) {
nsCOMPtr<nsIURI> uri, domain;
objectPrincipal->GetURI(getter_AddRefs(uri));
GetOriginFromURI(uri, objectOrigin);
if (uri) { // Object principal might be system
GetOriginFromURI(uri, objectOrigin);
}
objectPrincipal->GetDomain(getter_AddRefs(domain));
if (domain) {
GetOriginFromURI(domain, objectDomain);