mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 17:23:59 +00:00
Fixing crashes during tests by null-checking the principal URI as appropriate. Bug 495176
This commit is contained in:
parent
71e7b160c0
commit
123cf2cf60
@ -842,6 +842,9 @@ nsScriptSecurityManager::CheckPropertyAccessImpl(PRUint32 aAction,
|
|||||||
if (!nsAutoInPrincipalDomainOriginSetter::sInPrincipalDomainOrigin) {
|
if (!nsAutoInPrincipalDomainOriginSetter::sInPrincipalDomainOrigin) {
|
||||||
nsCOMPtr<nsIURI> uri, domain;
|
nsCOMPtr<nsIURI> uri, domain;
|
||||||
subjectPrincipal->GetURI(getter_AddRefs(uri));
|
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);
|
GetOriginFromURI(uri, subjectOrigin);
|
||||||
subjectPrincipal->GetDomain(getter_AddRefs(domain));
|
subjectPrincipal->GetDomain(getter_AddRefs(domain));
|
||||||
if (domain) {
|
if (domain) {
|
||||||
@ -859,7 +862,9 @@ nsScriptSecurityManager::CheckPropertyAccessImpl(PRUint32 aAction,
|
|||||||
objectPrincipal) {
|
objectPrincipal) {
|
||||||
nsCOMPtr<nsIURI> uri, domain;
|
nsCOMPtr<nsIURI> uri, domain;
|
||||||
objectPrincipal->GetURI(getter_AddRefs(uri));
|
objectPrincipal->GetURI(getter_AddRefs(uri));
|
||||||
GetOriginFromURI(uri, objectOrigin);
|
if (uri) { // Object principal might be system
|
||||||
|
GetOriginFromURI(uri, objectOrigin);
|
||||||
|
}
|
||||||
objectPrincipal->GetDomain(getter_AddRefs(domain));
|
objectPrincipal->GetDomain(getter_AddRefs(domain));
|
||||||
if (domain) {
|
if (domain) {
|
||||||
GetOriginFromURI(domain, objectDomain);
|
GetOriginFromURI(domain, objectDomain);
|
||||||
|
Loading…
Reference in New Issue
Block a user