nsICookieManager2
From MDC
The nsICookieManager2 interface contains additional methods that expand upon the frozen nsICookieManager interface.
Contents |
nsICookieManager2 is defined in netwerk/cookie/public/nsICookieManager2.idl. It is scriptable and
unfrozen (hasn't changed since Mozilla 1.9).
Inherits from: nsICookieManager
[edit] Method overview
void add(in AUTF8String aDomain, in AUTF8String aPath, in ACString aName, in ACString aValue, in boolean aSecure, in boolean aIsSession, in PRInt64 aExpiry);
|
boolean findMatchingCookie(in nsICookie2 aCookie, out unsigned long aCountFromHost);
|
[edit] Methods
[edit] add()
Adds a cookie. nsICookieService is the normal way to do this. This method is something of a backdoor.
void add(in AUTF8String aDomain, in AUTF8String aPath, in ACString aName, in ACString aValue, in boolean aSecure, in boolean aIsSession, in PRInt64 aExpiry );
[edit] Parameters
- aDomain
- The host or domain for which the cookie is set. presence of a leading dot indicates a domain cookie; otherwise, the cookie is treated as a non-domain cookie. see RFC2109.
- aPath
- The path within the domain for which the cookie is valid.
- aName
- The cookie name.
- aValue
- cookie data.
- aSecure
- Value is true if the cookie should only be sent over a secure connection.
- aIsSession
- Value is true if the cookie should exist for the current session only.
- aExpiry
- Holds the expiration date, in seconds since the epoch. only relevant if aIsSession is false.
[edit] findMatchingCookie()
Finds whether a matching cookie already exists, and how many cookies a given host has already set. For example, this is useful when prompting the user whether to accept a given cookie.
boolean findMatchingCookie( in nsICookie2 aCookie, out unsigned long aCountFromHost );
[edit] Parameters
- aCookie
- The cookie to look for.
- aCountFromHost
- The number of cookies found whose hosts are the same as, or subdomains of, the host field of aCookie.
[edit] Return value
Returns true if a cookie was found which matches the host, path, and name fields of aCookie.