2003-10-11 03:08:01 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2003-10-11 03:08:01 +04:00
|
|
|
|
|
|
|
#include "nsICookieManager.idl"
|
|
|
|
|
2003-10-11 04:06:13 +04:00
|
|
|
interface nsICookie2;
|
2007-11-12 12:28:22 +03:00
|
|
|
interface nsIFile;
|
2003-10-11 04:06:13 +04:00
|
|
|
|
2003-10-11 03:08:01 +04:00
|
|
|
/**
|
|
|
|
* Additions to the frozen nsICookieManager
|
|
|
|
*/
|
|
|
|
|
2012-09-28 01:37:02 +04:00
|
|
|
[scriptable, uuid(daf0caa7-b431-4b4d-ba51-08c179bb9dfe)]
|
2003-10-11 03:08:01 +04:00
|
|
|
interface nsICookieManager2 : nsICookieManager
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Add a cookie. nsICookieService is the normal way to do this. This
|
|
|
|
* method is something of a backdoor.
|
|
|
|
*
|
2010-01-12 21:29:20 +03:00
|
|
|
* @param aHost
|
2003-10-30 05:50:11 +03:00
|
|
|
* the host or domain for which the cookie is set. presence of a
|
|
|
|
* leading dot indicates a domain cookie; otherwise, the cookie
|
2010-01-12 21:29:20 +03:00
|
|
|
* is treated as a non-domain cookie (see RFC2109). The host string
|
|
|
|
* will be normalized to ASCII or ACE; any trailing dot will be
|
|
|
|
* stripped. To be a domain cookie, the host must have at least two
|
|
|
|
* subdomain parts (e.g. '.foo.com', not '.com'), otherwise an
|
|
|
|
* exception will be thrown. An empty string is acceptable
|
|
|
|
* (e.g. file:// URI's).
|
2003-10-11 04:06:13 +04:00
|
|
|
* @param aPath
|
|
|
|
* path within the domain for which the cookie is valid
|
|
|
|
* @param aName
|
|
|
|
* cookie name
|
|
|
|
* @param aValue
|
|
|
|
* cookie data
|
2007-06-18 03:40:40 +04:00
|
|
|
* @param aIsSecure
|
2003-10-30 05:50:11 +03:00
|
|
|
* true if the cookie should only be sent over a secure connection.
|
2007-06-18 03:40:40 +04:00
|
|
|
* @param aIsHttpOnly
|
|
|
|
* true if the cookie should only be sent to, and can only be
|
|
|
|
* modified by, an http connection.
|
2003-10-30 05:50:11 +03:00
|
|
|
* @param aIsSession
|
|
|
|
* true if the cookie should exist for the current session only.
|
2007-05-06 05:29:44 +04:00
|
|
|
* see aExpiry.
|
2003-10-30 05:50:11 +03:00
|
|
|
* @param aExpiry
|
2007-05-06 05:29:44 +04:00
|
|
|
* expiration date, in seconds since midnight (00:00:00), January 1,
|
|
|
|
* 1970 UTC. note that expiry time will also be honored for session cookies;
|
|
|
|
* in this way, the more restrictive of the two will take effect.
|
2003-10-11 03:08:01 +04:00
|
|
|
*/
|
2010-01-12 21:29:20 +03:00
|
|
|
void add(in AUTF8String aHost,
|
2003-10-11 04:06:13 +04:00
|
|
|
in AUTF8String aPath,
|
|
|
|
in ACString aName,
|
|
|
|
in ACString aValue,
|
2007-06-18 03:40:40 +04:00
|
|
|
in boolean aIsSecure,
|
|
|
|
in boolean aIsHttpOnly,
|
2003-10-30 05:50:11 +03:00
|
|
|
in boolean aIsSession,
|
2012-08-22 19:56:38 +04:00
|
|
|
in int64_t aExpiry);
|
2003-10-11 04:06:13 +04:00
|
|
|
|
|
|
|
/**
|
2007-05-06 01:09:54 +04:00
|
|
|
* Find whether a given cookie already exists.
|
2003-10-11 04:06:13 +04:00
|
|
|
*
|
|
|
|
* @param aCookie
|
|
|
|
* the cookie to look for
|
|
|
|
*
|
|
|
|
* @return true if a cookie was found which matches the host, path, and name
|
|
|
|
* fields of aCookie
|
|
|
|
*/
|
2007-05-06 01:09:54 +04:00
|
|
|
boolean cookieExists(in nsICookie2 aCookie);
|
|
|
|
|
|
|
|
/**
|
2009-12-20 02:55:56 +03:00
|
|
|
* Count how many cookies exist within the base domain of 'aHost'.
|
|
|
|
* Thus, for a host "weather.yahoo.com", the base domain would be "yahoo.com",
|
|
|
|
* and any host or domain cookies for "yahoo.com" and its subdomains would be
|
|
|
|
* counted.
|
2007-05-06 01:09:54 +04:00
|
|
|
*
|
|
|
|
* @param aHost
|
2010-01-12 21:29:20 +03:00
|
|
|
* the host string to search for, e.g. "google.com". this should consist
|
|
|
|
* of only the host portion of a URI. see @add for a description of
|
|
|
|
* acceptable host strings.
|
2007-05-06 01:09:54 +04:00
|
|
|
*
|
2007-09-04 06:07:23 +04:00
|
|
|
* @return the number of cookies found.
|
2007-05-06 01:09:54 +04:00
|
|
|
*/
|
2010-01-12 21:29:20 +03:00
|
|
|
unsigned long countCookiesFromHost(in AUTF8String aHost);
|
2007-11-12 12:28:22 +03:00
|
|
|
|
2009-07-16 04:57:29 +04:00
|
|
|
/**
|
2009-12-20 02:55:56 +03:00
|
|
|
* Returns an enumerator of cookies that exist within the base domain of
|
|
|
|
* 'aHost'. Thus, for a host "weather.yahoo.com", the base domain would be
|
|
|
|
* "yahoo.com", and any host or domain cookies for "yahoo.com" and its
|
|
|
|
* subdomains would be returned.
|
2009-07-16 04:57:29 +04:00
|
|
|
*
|
|
|
|
* @param aHost
|
2010-01-12 21:29:20 +03:00
|
|
|
* the host string to search for, e.g. "google.com". this should consist
|
|
|
|
* of only the host portion of a URI. see @add for a description of
|
|
|
|
* acceptable host strings.
|
2009-07-16 04:57:29 +04:00
|
|
|
*
|
|
|
|
* @return an nsISimpleEnumerator of nsICookie2 objects.
|
|
|
|
*
|
|
|
|
* @see countCookiesFromHost
|
|
|
|
*/
|
2010-01-12 21:29:20 +03:00
|
|
|
nsISimpleEnumerator getCookiesFromHost(in AUTF8String aHost);
|
2009-07-16 04:57:29 +04:00
|
|
|
|
2007-11-12 12:28:22 +03:00
|
|
|
/**
|
2007-11-14 04:36:54 +03:00
|
|
|
* Import an old-style cookie file. Imported cookies will be added to the
|
|
|
|
* existing database. If the database contains any cookies the same as those
|
|
|
|
* being imported (i.e. domain, name, and path match), they will be replaced.
|
2007-11-12 12:28:22 +03:00
|
|
|
*
|
|
|
|
* @param aCookieFile the file to import, usually cookies.txt
|
|
|
|
*/
|
|
|
|
void importCookies(in nsIFile aCookieFile);
|
2012-09-28 01:17:08 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns an enumerator of all cookies that are related to a specific app.
|
|
|
|
*
|
|
|
|
* If the onlyBrowserELement parameter is set to true, only cookies part of
|
|
|
|
* a browser element inside the app will be returned. If set to false, all
|
|
|
|
* cookies will be returned, regardless of their browserElement flag.
|
|
|
|
*
|
|
|
|
* This method assumes that appId is a valid app id. It should not be a
|
|
|
|
* special value like UNKNOWN_APP_ID or NO_APP_ID.
|
|
|
|
*/
|
|
|
|
nsISimpleEnumerator getCookiesForApp(in unsigned long appId, in boolean onlyBrowserElement);
|
2012-09-28 01:37:02 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove all the cookies associated with the app with the id aAppId.
|
|
|
|
*
|
|
|
|
* If onlyBrowserElement is set to true, the method will only remove the
|
|
|
|
* cookies marked as part of a browser element inside the app.
|
|
|
|
*
|
|
|
|
* Special app id values are not allowed (NO_APP_ID or UNKNOWN_APP_ID for example).
|
|
|
|
*/
|
|
|
|
void removeCookiesForApp(in unsigned long appId, in boolean onlyBrowserElement);
|
2003-10-11 03:08:01 +04:00
|
|
|
};
|