WARNING: Most of this content (with the exception of the Mozilla 1.9 XPCOM reference) is very old, and can be expected to be out of date and possibly obsolete. For better XUL documentation, please visit the XUL hub at the Mozilla Developer Center.

nsIPermissionManager

IID:00708302-684c-42d6-a5a3-995d51b1d17c
Inherits From:nsISupports

This interface is implemented by the following components:


Constants

Predefined return values for the testPermission method and for the permission param of the add method NOTE: UNKNOWN_ACTION (0) is reserved to represent the default permission when no entry is found for a host, and should not be used by consumers to indicate otherwise.
PRUint32 UNKNOWN_ACTION = 0
PRUint32 ALLOW_ACTION = 1
PRUint32 DENY_ACTION = 2

Properties

readonly nsISimpleEnumerator enumerator

Allows enumeration of all stored permissions


Methods

void add ( nsIURI uri , char* type , PRUint32 permission ) void remove ( AUTF8String host , char* type ) void removeAll ( ) PRUint32 testExactPermission ( nsIURI uri , char* type ) PRUint32 testPermission ( nsIURI uri , char* type )

void add ( nsIURI uri , char* type , PRUint32 permission )

Add permission information for a given URI and permission type. This operation will cause the type string to be registered if it does not currently exist. If a permission already exists for a given type, it will be modified.

Arguments:
uri: the uri to add the permission for
type: a case-sensitive ASCII string, identifying the consumer. Consumers should choose this string to be unique, with respect to other consumers.
permission: an integer representing the desired action (e.g. allow or deny). The interpretation of this number is up to the consumer, and may represent different actions for different types. Consumers may use one of the enumerated permission actions defined above, for convenience. NOTE: UNKNOWN_ACTION (0) is reserved to represent the default permission when no entry is found for a host, and should not be used by consumers to indicate otherwise.

void remove ( AUTF8String host , char* type )

Remove permission information for a given host string and permission type. The host string represents the exact entry in the permission list (such as obtained from the enumerator), not a URI which that permission might apply to.

Arguments:
host: the host to remove the permission for
type: a case-sensitive ASCII string, identifying the consumer. The type must have been previously registered using the add() method.

void removeAll ( )

Clear permission information for all websites.


PRUint32 testExactPermission ( nsIURI uri , char* type )

Test whether a website has permission to perform the given action. This requires an exact hostname match, subdomains are not a match.

Arguments:
uri: the uri to be tested
type: a case-sensitive ASCII string, identifying the consumer

PRUint32 testPermission ( nsIURI uri , char* type )

Test whether a website has permission to perform the given action.

Arguments:
uri: the uri to be tested
type: a case-sensitive ASCII string, identifying the consumer

Reference documentation is generated from Mozilla's source.