Linux Mac OSX Windows

Implemented by


  
[scriptable, uuid(4f6b5e00-0c36-11d5-a535-0010a401eb10)]
interface nsIPermissionManager : nsISupports

Constants

 Predefined return values for the testPermission method and for
 the permission param of the add method
const PRUint32 UNKNOWN_ACTION = 0

        
const PRUint32 ALLOW_ACTION = 1

        
const PRUint32 DENY_ACTION = 2

Attributes

 Allows enumeration of all stored permissions
 @return an nsISimpleEnumerator interface that allows access to
         nsIPermission objects
readonly attribute nsISimpleEnumerator enumerator

Methods

 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.

 @param uri         the uri to add the permission for
 @param type        a case-sensitive ASCII string, identifying the consumer.
                    Consumers should choose this string to be unique, with
                    respect to other consumers. The number of unique type
                    indentifiers may be limited.
 @param permission  an integer from 1 to 15, 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. 0 is reserved for UNKNOWN_ACTION, and shouldn't
                    be used.
 @throws            NS_ERROR_FAILURE if there is no more room for adding
                    a new type
void add(in nsIURI uri, in string type, in PRUint32 permission)
 Remove permission information for a given URI and permission type.
 Note that this method takes a host string, not an nsIURI.

 @param host   the host to remove the permission for
 @param type   a case-sensitive ASCII string, identifying the consumer. 
               The type must have been previously registered using the
               add() method.
void remove(in AUTF8String host, in string type)
 Clear permission information for all websites.
void removeAll()
 Test whether a website has permission to perform the given action.
 @param uri     the uri to be tested
 @param type    a case-sensitive ASCII string, identifying the consumer
 @param return  see add(), param permission. returns UNKNOWN_ACTION when
                there is no stored permission for this uri and / or type.
PRUint32 testPermission(in nsIURI uri, in string type)