netwerk/cookie/nsICookiePermission.idl

Wed, 31 Dec 2014 06:55:46 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:46 +0100
changeset 1
ca08bd8f51b2
permissions
-rw-r--r--

Added tag TORBROWSER_REPLICA for changeset 6474c204b198

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

mercurial