The nsIPermissionManager interface is used to persistently store permissions for different object types (cookies, images, and so on) on a site-by-site basis.
Inherits from: nsISupports
void add(in nsIURI uri, in string type, in PRUint32 permission, [optional] in PRUint32 expireType, [optional] in PRInt64 expireTime); |
void addFromPrincipal(in nsIPrincipal principal, in string type, in PRUint32 permission, [optional] in PRUint32 expireType, [optional] in PRInt64 expireTime); |
void remove(in AUTF8String host, in string type); |
|
|
|
void removeAll(); |
PRUint32 testExactPermission(in nsIURI uri, in string type); |
PRUint32 testExactPermissionFromPrincipal(in nsIPrincipal principal, in string type); |
PRUint32 testPermission(in nsIURI uri, in string type); |
PRUint32 testPermissionFromPrincipal(in nsIPrincipal principal, in string type); |
Attribute | Type | Description |
enumerator |
|
Enumerates all stored permissions. Allows access to nsIPermission objects. Read only. |
Constant | Value | Description |
UNKNOWN_ACTION |
0 |
Default permission when no entry is found for a host. It should not be used by consumers. |
ALLOW_ACTION |
1 |
Permission is allowed. |
DENY_ACTION |
2 |
Permission is denied. |
PROMPT_ACTION |
3 |
Prompt user if the permission is allowed. |
Constant | Value | Description |
EXPIRE_NEVER |
0 |
Permission never expires. |
EXPIRE_SESSION |
1 |
Permission expires at end of session. |
EXPIRE_TIME |
2 |
Permission expires at a specified time. |
Add permission information and permission type for a given URI. If the permission already exists for a given type, it will be modified.
void add( in nsIURI uri, in string type, in PRUint32 permission, [optional] in PRUint32 expireType, [optional] in PRInt64 expireTime );
uri
type
permission
nsIPermissionManager.Permission_type_constants
.expireType
nsIPermissionManager.Permission_expiration_constants
.expireTime
Add permission information and permission type for a given principal. If the permission already exists for a given type, it will be modified. It is internally calling add()
method using the nsIURI from the principal.
void addFromPrincipal( in nsIPrincipal principal, in string type, in PRUint32 permission, [optional] in PRUint32 expireType, [optional] in PRInt64 expireTime );
principal
type
permission
nsIPermissionManager.Permission_type_constants
.expireType
nsIPermissionManager.Permission_expiration_constants
.expireTime
Remove permission information for a given host string and permission type.
void remove(
in nsIURI uri
,
in string type
);
nsIURI
type
add()
method.Remove permission information for a given principal and permission type.
void removeFromPrincipal( in nsIPrincipal principal, in string type );
principal
type
add()
method.Remove a given permission from the stored permissions.
void removePermission(
in nsIPermission perm
);
Remove permission information for a given host string and permission type.
void remove(
in int64_t since
);
since
Remove permission information for all URIs.
void removeAll();
None.
Checks if a URI is permitted to perform an action. This requires an exact hostname match, subdomains are not a match.
PRUint32 testExactPermission( in nsIURI uri, in string type );
uri
type
A PRUint32 representing the permission, or UNKNOWN_ACTION if no permission exists.
Checks if a principal is permitted to perform an action. See testExactPermission()
.
PRUint32 testExactPermissionFromPrincipal( in nsIPrincipal principal, in string type );
principal
type
A PRUint32 representing the permission, or UNKNOWN_ACTION if no permission exists.
Checks if a URI is permitted to perform an action.
PRUint32 testPermission( in nsIURI uri, in string type );
uri
type
A PRUint32 representing the permission, or UNKNOWN_ACTION if no permission exists.
Checks if a principal is permitted to perform an action.
PRUint32 testPermissionFromPrincipal( in nsIPrincipal principal, in string type );
principal
type
A PRUint32 representing the permission, or UNKNOWN_ACTION if no permission exists.
This service broadcasts the following notification when the permission list is changed:
topic : "perm-changed" (PERM_CHANGE_NOTIFICATION) broadcast whenever the permission list changes in some way.
There are four possible data strings for this notification; one notification will be broadcast for each change, and will involve a single permission.
data : "deleted" a permission was deleted. The subject is the deleted nsIPermission
.
data : "added" a permission was added. The subject is the added nsIPermission
.
data : "changed" a permission was changed. The subject is the new nsIPermission
.
data : "cleared" the entire permission list was cleared. The subject is null
.