The nsICookiePermission
interface is used to test for cookie permissions
Inherits from: nsISupports
nsCookieAccess canAccess(in nsIURI aURI, in nsIChannel aChannel); |
boolean canSetCookie(in nsIURI aURI, in nsIChannel aChannel, in nsICookie2 aCookie, inout boolean aIsSession, inout PRInt64 aExpiry); |
nsIURI getOriginatingURI(in nsIChannel aChannel); |
void setAccess(in nsIURI aURI, in nsCookieAccess aAccess); |
Constant | Value | Description |
ACCESS_DEFAULT | 0 | nsCookieAccess 's access default value |
ACCESS_ALLOW | 1 | nsCookieAccess 's access allow value |
ACCESS_DENY | 2 | nsCookieAccess 's access deny value |
ACCESS_SESSION | 8 | 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. |
Tests whether or not the given URI/channel may access the cookie database, either to set or get cookies.
nsCookieAccess canAccess(
in nsIURI aURI,
in nsIURI aFirstURI, Obsolete since Gecko 1.9
in nsIChannel aChannel
);
aURI
aFirstURI
aURI
being loaded.aChannel
aURI
.One of the nsCookieAccess
values: ACCESS_DEFAULT
, ACCESS_ALLOW
, or ACCESS_DENY
.
Tests 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 aIsSession
and aExpiry
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.
boolean canSetCookie( in nsIURI aURI, in nsIChannel aChannel, in nsICookie2 aCookie, inout boolean aIsSession, inout PRInt64 aExpiry );
aURI
aChannel
aURI
.aCookie
aIsSession
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.aExpiry
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.true
if the cookie can be set.
Determines the originating URI for a load given a channel, for third-party cookie blocking. This is done by leveraging the loadgroup of the channel to find the root content docshell, and the URI associated with its principal. If the root content docshell or its principal's URI cannot be obtained, this method will throw.
nsIURI getOriginatingURI( in nsIChannel aChannel );
aChannel
The originating URI.
Sets cookie access permissions for the given URI. This may result in other URIs being blocked as well, such as URIs that share the same host name.
void setAccess( in nsIURI aURI, in nsCookieAccess aAccess );
aURI
aAccess