netwerk/cookie/nsICookiePermission.idl

Wed, 31 Dec 2014 07:22:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:22:50 +0100
branch
TOR_BUG_3246
changeset 4
fc2d59ddac77
permissions
-rw-r--r--

Correct previous dual key logic pending first delivery installment.

     1 /* This Source Code Form is subject to the terms of the Mozilla Public
     2  * License, v. 2.0. If a copy of the MPL was not distributed with this
     3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     5 #include "nsISupports.idl"
     7 interface nsICookie2;
     8 interface nsIURI;
     9 interface nsIChannel;
    11 typedef long nsCookieAccess;
    13 /**
    14  * An interface to test for cookie permissions
    15  */
    16 [scriptable, uuid(11ddd4ed-8f5b-40b3-b2a0-27c20ea1c88d)]
    17 interface nsICookiePermission : nsISupports
    18 {
    19   /**
    20    * nsCookieAccess values
    21    */
    22   const nsCookieAccess ACCESS_DEFAULT = 0;
    23   const nsCookieAccess ACCESS_ALLOW   = 1;
    24   const nsCookieAccess ACCESS_DENY    = 2;
    26   /**
    27    * additional values for nsCookieAccess which may not match
    28    * nsIPermissionManager. Keep 3-7 available to allow nsIPermissionManager to
    29    * add values without colliding. ACCESS_SESSION is not directly returned by
    30    * any methods on this interface.
    31    */
    32   const nsCookieAccess ACCESS_SESSION = 8;
    33   const nsCookieAccess ACCESS_ALLOW_FIRST_PARTY_ONLY = 9;
    34   const nsCookieAccess ACCESS_LIMIT_THIRD_PARTY = 10;
    36   /**
    37    * setAccess
    38    *
    39    * this method is called to block cookie access for the given URI.  this
    40    * may result in other URIs being blocked as well (e.g., URIs which share
    41    * the same host name).
    42    *
    43    * @param aURI
    44    *        the URI to block
    45    * @param aAccess
    46    *        the new cookie access for the URI.
    47    */
    48   void setAccess(in nsIURI         aURI,
    49                  in nsCookieAccess aAccess);
    51   /**
    52    * canAccess
    53    *
    54    * this method is called to test whether or not the given URI/channel may
    55    * access the cookie database, either to set or get cookies.
    56    *
    57    * @param aURI
    58    *        the URI trying to access cookies
    59    * @param aChannel
    60    *        the channel corresponding to aURI
    61    *
    62    * @return one of the following nsCookieAccess values:
    63    *         ACCESS_DEFAULT, ACCESS_ALLOW, ACCESS_DENY, or
    64    *         ACCESS_ALLOW_FIRST_PARTY_ONLY
    65    */
    66   nsCookieAccess canAccess(in nsIURI     aURI,
    67                            in nsIChannel aChannel);
    69   /**
    70    * canSetCookie
    71    *
    72    * this method is called to test whether or not the given URI/channel may
    73    * set a specific cookie.  this method is always preceded by a call to
    74    * canAccess. it may modify the isSession and expiry attributes of the
    75    * cookie via the aIsSession and aExpiry parameters, in order to limit
    76    * or extend the lifetime of the cookie. this is useful, for instance, to
    77    * downgrade a cookie to session-only if it fails to meet certain criteria.
    78    *
    79    * @param aURI
    80    *        the URI trying to set the cookie
    81    * @param aChannel
    82    *        the channel corresponding to aURI
    83    * @param aCookie
    84    *        the cookie being added to the cookie database
    85    * @param aIsSession
    86    *        when canSetCookie is invoked, this is the current isSession attribute
    87    *        of the cookie. canSetCookie may leave this value unchanged to
    88    *        preserve this attribute of the cookie.
    89    * @param aExpiry
    90    *        when canSetCookie is invoked, this is the current expiry time of
    91    *        the cookie. canSetCookie may leave this value unchanged to
    92    *        preserve this attribute of the cookie.
    93    *
    94    * @return true if the cookie can be set.
    95    */
    96   boolean canSetCookie(in nsIURI     aURI,
    97                        in nsIChannel aChannel,
    98                        in nsICookie2 aCookie,
    99                        inout boolean aIsSession,
   100                        inout int64_t aExpiry);
   101 };
   103 %{ C++
   104 /**
   105  * The nsICookiePermission implementation is an XPCOM service registered
   106  * under the ContractID:
   107  */
   108 #define NS_COOKIEPERMISSION_CONTRACTID "@mozilla.org/cookie/permission;1"
   109 %}

mercurial