netwerk/cookie/nsICookieManager2.idl

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

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

mercurial