From ebfb3f57c92b0f9e8c0f5ac7e4e0f45d5b8d7134 Mon Sep 17 00:00:00 2001 From: Mounir Lamouri Date: Wed, 18 Jul 2012 11:38:02 -0700 Subject: [PATCH] Bug 769594 - Make nsContentUtils use TestPermissionFromPrincipal instead of TestPermission. r=sicking --- content/base/src/nsContentUtils.cpp | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/content/base/src/nsContentUtils.cpp b/content/base/src/nsContentUtils.cpp index 57b7ae00231..5425f0c53a6 100644 --- a/content/base/src/nsContentUtils.cpp +++ b/content/base/src/nsContentUtils.cpp @@ -2774,17 +2774,9 @@ nsContentUtils::IsDraggableLink(const nsIContent* aContent) { static bool TestSitePerm(nsIPrincipal* aPrincipal, const char* aType, PRUint32 aPerm) { - if (nsContentUtils::IsSystemPrincipal(aPrincipal)) { - // System principal is always allowed and never denied permission. - return aPerm == nsIPermissionManager::ALLOW_ACTION; - } - - nsCOMPtr uri; - if (NS_FAILED(!aPrincipal || - aPrincipal->GetURI(getter_AddRefs(uri))) || - !uri) { - // We always deny (i.e. don't allow) the permission if we don't - // have a principal or we don't know the URI. + if (!aPrincipal) { + // We always deny (i.e. don't allow) the permission if we don't have a + // principal. return aPerm != nsIPermissionManager::ALLOW_ACTION; } @@ -2793,9 +2785,9 @@ TestSitePerm(nsIPrincipal* aPrincipal, const char* aType, PRUint32 aPerm) NS_ENSURE_TRUE(permMgr, false); PRUint32 perm; - nsresult rv = permMgr->TestPermission(uri, aType, &perm); + nsresult rv = permMgr->TestPermissionFromPrincipal(aPrincipal, aType, &perm); NS_ENSURE_SUCCESS(rv, false); - + return perm == aPerm; }