nsICookiePermission

IID:91f1c3ec-73a0-4bf0-bdc5-348a1f181b0e
Inherits From:nsISupports

An interface to test for cookie permissions

This interface is implemented by the following components:


Constants

NsCookieAccess values
nsCookieAccess ACCESS_DEFAULT = 0
nsCookieAccess ACCESS_ALLOW = 1
nsCookieAccess ACCESS_DENY = 2
Additional values for nsCookieAccess, which are not directly used by any methods on this interface, but are nevertheless convenient to define here. these may be relocated somewhere else if we ever consider freezing this interface.
nsCookieAccess ACCESS_SESSION = 8

Methods

nsCookieAccess canAccess ( nsIURI URI , nsIURI firstURI , nsIChannel channel ) PRBool canSetCookie ( nsIURI URI , nsIChannel channel , nsICookie2 cookie , inout PRBool isSession , inout PRInt64 expiry ) void setAccess ( nsIURI URI , nsCookieAccess access )

nsCookieAccess canAccess ( nsIURI URI , nsIURI firstURI , nsIChannel channel )

This method is called to test whether or not the given URI/channel may access the cookie database, either to set or get cookies.

Arguments:
URI: the URI trying to access cookies
firstURI: the URI initiated by the user that resulted in uRI being loaded
channel: the channel corresponding to uRI
Returns:
one of the following nsCookieAccess values: ACCESS_DEFAULT, ACCESS_ALLOW, or ACCESS_DENY

PRBool canSetCookie ( nsIURI URI , nsIChannel channel , nsICookie2 cookie , inout PRBool isSession , inout PRInt64 expiry )

This method is called to test whether or not the given URI/channel may set a specific cookie. this method is always preceded by a call to canAccess. it may modify the isSession and expiry attributes of the cookie via the isSession and expiry parameters, in order to limit or extend the lifetime of the cookie. this is useful, for instance, to downgrade a cookie to session-only if it fails to meet certain criteria.

Arguments:
URI: the URI trying to set the cookie
channel: the corresponding to uRI
cookie: the cookie being added to the cookie database
isSession: when canSetCookie is invoked, this is the current isSession attribute of the cookie. canSetCookie may leave this value unchanged to preserve this attribute of the cookie.
expiry: when canSetCookie is invoked, this is the current expiry time of the cookie. canSetCookie may leave this value unchanged to preserve this attribute of the cookie.
Returns:
true if the cookie can be set.

void setAccess ( nsIURI URI , nsCookieAccess access )

This method is called to block cookie access for the given URI. this may result in other URIs being blocked as well (e.g., URIs which share the same host name).

Arguments:
URI: the URI to block
access: the new cookie access for the URI.

Reference documentation is generated from Mozilla's source.

Add a note User Contributed Notes
No comments available

Copyright © 1999 - 2005 XULPlanet.com