tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

nsICookie.idl (4915B)


      1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
      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/. */
      5 
      6 #include "nsISupports.idl"
      7 
      8 /**
      9 * Main cookie object interface.
     10 */
     11 
     12 %{C++
     13 namespace mozilla {
     14  class OriginAttributes;
     15 
     16  namespace net {
     17    class Cookie;
     18  }
     19 }
     20 %}
     21 
     22 [ref] native const_OriginAttributes(const mozilla::OriginAttributes);
     23 [ref] native const_Cookie(const mozilla::net::Cookie);
     24 
     25 typedef long nsCookieStatus;
     26 typedef long nsCookiePolicy;
     27 
     28 [builtinclass, scriptable, uuid(adf0db5e-211e-45a3-be14-4486ac430a58)]
     29 interface nsICookie : nsISupports {
     30    const uint32_t SAMESITE_NONE   = 0;
     31    const uint32_t SAMESITE_LAX    = 1;
     32    const uint32_t SAMESITE_STRICT = 2;
     33    const uint32_t SAMESITE_UNSET = 256;
     34 
     35    /**
     36     * the name of the cookie
     37     */
     38    readonly attribute ACString name;
     39 
     40    /**
     41     * the cookie value
     42     */
     43    readonly attribute AUTF8String value;
     44 
     45    /**
     46     * true if the cookie is a domain cookie, false otherwise
     47     */
     48    readonly attribute boolean isDomain;
     49 
     50    /**
     51     * the host (possibly fully qualified) of the cookie
     52     */
     53    readonly attribute AUTF8String host;
     54 
     55    /**
     56     * the host (possibly fully qualified) of the cookie,
     57     * without a leading dot to represent if it is a
     58     * domain cookie.
     59     */
     60    readonly attribute AUTF8String rawHost;
     61 
     62    /**
     63     * the path pertaining to the cookie
     64     */
     65    readonly attribute AUTF8String path;
     66 
     67    /**
     68     * true if the cookie was transmitted over ssl, false otherwise
     69     */
     70    readonly attribute boolean isSecure;
     71 
     72    /**
     73     * @DEPRECATED use nsICookie.expiry and nsICookie.isSession instead.
     74     *
     75     * expiration time in seconds since midnight (00:00:00), January 1, 1970 UTC.
     76     * expires = 0 represents a session cookie.
     77     * expires = 1 represents an expiration time earlier than Jan 1, 1970.
     78     */
     79    readonly attribute uint64_t expires;
     80 
     81    /**
     82     * the actual expiry time of the cookie, in milliseconds
     83     * since midnight (00:00:00), January 1, 1970 UTC.
     84     *
     85     * this is distinct from nsICookie::expires, which
     86     * has different and obsolete semantics.
     87     */
     88    readonly attribute int64_t expiry;
     89 
     90    /**
     91     * The origin attributes for this cookie
     92     */
     93    [implicit_jscontext]
     94    readonly attribute jsval originAttributes;
     95 
     96    /**
     97     * Native getter for origin attributes
     98     */
     99    [noscript, notxpcom, nostdcall, binaryname(OriginAttributesNative)]
    100    const_OriginAttributes OriginAttributesNative();
    101 
    102    [noscript, notxpcom, nostdcall, binaryname(AsCookie)]
    103    const_Cookie AsCookie();
    104 
    105    /**
    106     * true if the cookie is a session cookie.
    107     * note that expiry time will also be honored
    108     * for session cookies (see below); thus, whichever is
    109     * the more restrictive of the two will take effect.
    110     */
    111    readonly attribute boolean isSession;
    112 
    113    /**
    114     * true if the cookie is an http only cookie
    115     */
    116    readonly attribute boolean isHttpOnly;
    117 
    118    /**
    119     * the creation time of the cookie, in microseconds
    120     * since midnight (00:00:00), January 1, 1970 UTC.
    121     */
    122    readonly attribute int64_t creationTime;
    123 
    124    /**
    125     * the update time of the cookie, in microseconds
    126     * since midnight (00:00:00), January 1, 1970 UTC.
    127     * It is the same as creationTime for a new cookie
    128     * or different for a cookie that was replaced.
    129     */
    130    readonly attribute int64_t updateTime;
    131 
    132    /**
    133     * the last time the cookie was accessed (i.e. created,
    134     * modified, or read by the server), in microseconds
    135     * since midnight (00:00:00), January 1, 1970 UTC.
    136     *
    137     * note that this time may be approximate.
    138     */
    139    readonly attribute int64_t lastAccessed;
    140 
    141    /**
    142     * the SameSite attribute; this controls the cookie behavior for cross-site
    143     * requests as per
    144     * https://tools.ietf.org/html/draft-west-first-party-cookies-07
    145     *
    146     * This should be one of:
    147     * - SAMESITE_NONE - the SameSite attribute is not present
    148     * - SAMESITE_LAX - the SameSite attribute is present, but not strict
    149     * - SAMESITE_STRICT - the SameSite attribute is present and strict
    150     */
    151    readonly attribute int32_t sameSite;
    152 
    153    /**
    154     * The list of possible schemes of cookies. It's a bitmap because a cookie
    155     * can be set on HTTP and HTTPS. At the moment, we treat it as the same
    156     * cookie.
    157     */
    158    cenum schemeType : 8 {
    159      SCHEME_UNSET = 0x00,
    160      SCHEME_HTTP = 0x01,
    161      SCHEME_HTTPS = 0x02,
    162      SCHEME_FILE = 0x04,
    163    };
    164 
    165    /**
    166     * Bitmap of schemes.
    167     */
    168    readonly attribute nsICookie_schemeType schemeMap;
    169 
    170    /**
    171     * true if the cookie's OriginAttributes PartitionKey is NOT empty
    172     */
    173    readonly attribute boolean isPartitioned;
    174 };