nsISupports
Last changed in Gecko 1.9 (Firefox 3)See nsICookieManager
and nsICookieManager2
for methods to manipulate the cookie database directly. This separation of interface is mainly historical.
var cookieSvc = Components.classes["@mozilla.org/cookieService;1"] .getService(Components.interfaces.nsICookieService);
This service broadcasts the following notifications when the cookie list is changed, or a cookie is rejected:
Topic | Subject | Data |
---|---|---|
|
Depending on the Data value, either an nsICookie2 interface pointer representing the cookie object that changed, or an nsIArray of nsICookie2 objects. |
A keyword indicating what was done to the affected cookie.
|
private-cookie-changed Since Firefox 20 (see bugzilla #837091) |
Same as cookie-changed , except used in lieu of cookie-changed for private windows. |
See cookie-changed . |
cookie-rejected
Broadcast whenever the user's preferences cause a cookie to be rejected from being set. |
An nsIURI interface pointer representing the URI that attempted to set the cookie. |
None. |
string getCookieString(in nsIURI aURI, in nsIChannel aChannel); |
string getCookieStringFromHttp(in nsIURI aURI, in nsIURI aFirstURI, in nsIChannel aChannel); |
void setCookieString(in nsIURI aURI, in nsIPrompt aPrompt, in string aCookie, in nsIChannel aChannel); |
void setCookieStringFromHttp(in nsIURI aURI, in nsIURI aFirstURI, in nsIPrompt aPrompt, in string aCookie, in string aServerTime, in nsIChannel aChannel); |
Attribute | Type | Description |
cookieIconIsVisible |
boolean |
This attribute really doesn't belong on this interface. CVS blame will tell you why it is here. It remains until we can find a better home for it. |
Get the complete cookie string associated with the URI.
string getCookieString( in nsIURI aURI, in nsIChannel aChannel );
aURI
aChannel
Returns the resulting cookie string.
Get the complete cookie string associated with the URI.
getCookieString()
will query the documentURI
property off of nsIHttpChannelInternal
if supported, so getCookieString()
can be used in place of this method.string getCookieStringFromHttp( in nsIURI aURI, in nsIURI aFirstURI, in nsIChannel aChannel );
aURI
aFirstURI
aURI
.aChannel
Returns the resulting cookie string.
Set the cookie string associated with the URI.
aPrompt
, since nsIPrompt
can be queried from aChannel.void setCookieString( in nsIURI aURI, in nsIPrompt aPrompt, in string aCookie, in nsIChannel aChannel );
aURI
aPrompt
aCookie
aChannel
Set the cookie string and expires associated with the URI.
setCookieString()
will query the documentURI
property off of nsIHttpChannelInternal
if supported, and setCookieString()
could also query the Date header from the channel if aChannel
supports nsIHttpChannel
.void setCookieStringFromHttp( in nsIURI aURI, in nsIURI aFirstURI, in nsIPrompt aPrompt, in string aCookie, in string aServerTime, in nsIChannel aChannel );
aURI
aFirstURI
aPrompt
aCookie
aServerTime
aChannel