netwerk/cookie/nsICookieManager2.idl

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #include "nsICookieManager.idl"
michael@0 7
michael@0 8 interface nsICookie2;
michael@0 9 interface nsIFile;
michael@0 10
michael@0 11 /**
michael@0 12 * Additions to the frozen nsICookieManager
michael@0 13 */
michael@0 14
michael@0 15 [scriptable, uuid(daf0caa7-b431-4b4d-ba51-08c179bb9dfe)]
michael@0 16 interface nsICookieManager2 : nsICookieManager
michael@0 17 {
michael@0 18 /**
michael@0 19 * Add a cookie. nsICookieService is the normal way to do this. This
michael@0 20 * method is something of a backdoor.
michael@0 21 *
michael@0 22 * @param aHost
michael@0 23 * the host or domain for which the cookie is set. presence of a
michael@0 24 * leading dot indicates a domain cookie; otherwise, the cookie
michael@0 25 * is treated as a non-domain cookie (see RFC2109). The host string
michael@0 26 * will be normalized to ASCII or ACE; any trailing dot will be
michael@0 27 * stripped. To be a domain cookie, the host must have at least two
michael@0 28 * subdomain parts (e.g. '.foo.com', not '.com'), otherwise an
michael@0 29 * exception will be thrown. An empty string is acceptable
michael@0 30 * (e.g. file:// URI's).
michael@0 31 * @param aPath
michael@0 32 * path within the domain for which the cookie is valid
michael@0 33 * @param aName
michael@0 34 * cookie name
michael@0 35 * @param aValue
michael@0 36 * cookie data
michael@0 37 * @param aIsSecure
michael@0 38 * true if the cookie should only be sent over a secure connection.
michael@0 39 * @param aIsHttpOnly
michael@0 40 * true if the cookie should only be sent to, and can only be
michael@0 41 * modified by, an http connection.
michael@0 42 * @param aIsSession
michael@0 43 * true if the cookie should exist for the current session only.
michael@0 44 * see aExpiry.
michael@0 45 * @param aExpiry
michael@0 46 * expiration date, in seconds since midnight (00:00:00), January 1,
michael@0 47 * 1970 UTC. note that expiry time will also be honored for session cookies;
michael@0 48 * in this way, the more restrictive of the two will take effect.
michael@0 49 */
michael@0 50 void add(in AUTF8String aHost,
michael@0 51 in AUTF8String aPath,
michael@0 52 in ACString aName,
michael@0 53 in ACString aValue,
michael@0 54 in boolean aIsSecure,
michael@0 55 in boolean aIsHttpOnly,
michael@0 56 in boolean aIsSession,
michael@0 57 in int64_t aExpiry);
michael@0 58
michael@0 59 /**
michael@0 60 * Find whether a given cookie already exists.
michael@0 61 *
michael@0 62 * @param aCookie
michael@0 63 * the cookie to look for
michael@0 64 *
michael@0 65 * @return true if a cookie was found which matches the host, path, and name
michael@0 66 * fields of aCookie
michael@0 67 */
michael@0 68 boolean cookieExists(in nsICookie2 aCookie);
michael@0 69
michael@0 70 /**
michael@0 71 * Count how many cookies exist within the base domain of 'aHost'.
michael@0 72 * Thus, for a host "weather.yahoo.com", the base domain would be "yahoo.com",
michael@0 73 * and any host or domain cookies for "yahoo.com" and its subdomains would be
michael@0 74 * counted.
michael@0 75 *
michael@0 76 * @param aHost
michael@0 77 * the host string to search for, e.g. "google.com". this should consist
michael@0 78 * of only the host portion of a URI. see @add for a description of
michael@0 79 * acceptable host strings.
michael@0 80 *
michael@0 81 * @return the number of cookies found.
michael@0 82 */
michael@0 83 unsigned long countCookiesFromHost(in AUTF8String aHost);
michael@0 84
michael@0 85 /**
michael@0 86 * Returns an enumerator of cookies that exist within the base domain of
michael@0 87 * 'aHost'. Thus, for a host "weather.yahoo.com", the base domain would be
michael@0 88 * "yahoo.com", and any host or domain cookies for "yahoo.com" and its
michael@0 89 * subdomains would be returned.
michael@0 90 *
michael@0 91 * @param aHost
michael@0 92 * the host string to search for, e.g. "google.com". this should consist
michael@0 93 * of only the host portion of a URI. see @add for a description of
michael@0 94 * acceptable host strings.
michael@0 95 *
michael@0 96 * @return an nsISimpleEnumerator of nsICookie2 objects.
michael@0 97 *
michael@0 98 * @see countCookiesFromHost
michael@0 99 */
michael@0 100 nsISimpleEnumerator getCookiesFromHost(in AUTF8String aHost);
michael@0 101
michael@0 102 /**
michael@0 103 * Import an old-style cookie file. Imported cookies will be added to the
michael@0 104 * existing database. If the database contains any cookies the same as those
michael@0 105 * being imported (i.e. domain, name, and path match), they will be replaced.
michael@0 106 *
michael@0 107 * @param aCookieFile the file to import, usually cookies.txt
michael@0 108 */
michael@0 109 void importCookies(in nsIFile aCookieFile);
michael@0 110
michael@0 111 /**
michael@0 112 * Returns an enumerator of all cookies that are related to a specific app.
michael@0 113 *
michael@0 114 * If the onlyBrowserELement parameter is set to true, only cookies part of
michael@0 115 * a browser element inside the app will be returned. If set to false, all
michael@0 116 * cookies will be returned, regardless of their browserElement flag.
michael@0 117 *
michael@0 118 * This method assumes that appId is a valid app id. It should not be a
michael@0 119 * special value like UNKNOWN_APP_ID or NO_APP_ID.
michael@0 120 */
michael@0 121 nsISimpleEnumerator getCookiesForApp(in unsigned long appId, in boolean onlyBrowserElement);
michael@0 122
michael@0 123 /**
michael@0 124 * Remove all the cookies associated with the app with the id aAppId.
michael@0 125 *
michael@0 126 * If onlyBrowserElement is set to true, the method will only remove the
michael@0 127 * cookies marked as part of a browser element inside the app.
michael@0 128 *
michael@0 129 * Special app id values are not allowed (NO_APP_ID or UNKNOWN_APP_ID for example).
michael@0 130 */
michael@0 131 void removeCookiesForApp(in unsigned long appId, in boolean onlyBrowserElement);
michael@0 132 };

mercurial