Bug 1527505 - Part 9: Make nsIPermissionManager accept ACString arguments for permission types instead of raw C strings; r=nika

This will mean that in places like the tight loop in GetTypeIndex()
we would no longer require calling strlen() on the input type argument
once per loop iteration.

Depends on D20236

Differential Revision: https://phabricator.services.mozilla.com/D20237
This commit is contained in:
Ehsan Akhgari
2019-02-21 22:54:28 +00:00
parent 21684d4e6b
commit 6bcfe664eb
36 changed files with 257 additions and 229 deletions

View File

@@ -259,8 +259,8 @@ static bool PrincipalAllowsBrowserFrame(nsIPrincipal* aPrincipal) {
mozilla::services::GetPermissionManager();
NS_ENSURE_TRUE(permMgr, false);
uint32_t permission = nsIPermissionManager::DENY_ACTION;
nsresult rv =
permMgr->TestPermissionFromPrincipal(aPrincipal, "browser", &permission);
nsresult rv = permMgr->TestPermissionFromPrincipal(
aPrincipal, NS_LITERAL_CSTRING("browser"), &permission);
NS_ENSURE_SUCCESS(rv, false);
return permission == nsIPermissionManager::ALLOW_ACTION;
}