1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include
"nsISupports.idl"
10 * Main cookie object interface.
15 class OriginAttributes
;
23 [ref] native const_OriginAttributes
(const mozilla
::OriginAttributes
);
24 [ref] native const_Cookie
(const mozilla
::net
::Cookie
);
26 typedef long nsCookieStatus
;
27 typedef long nsCookiePolicy
;
29 [builtinclass
, scriptable
, uuid(adf0db5e
-211e
-45a3
-be14
-4486ac430a58
)]
30 interface nsICookie
: nsISupports
{
31 const uint32_t SAMESITE_NONE
= 0;
32 const uint32_t SAMESITE_LAX
= 1;
33 const uint32_t SAMESITE_STRICT
= 2;
36 * the name of the cookie
38 readonly attribute ACString name
;
43 readonly attribute AUTF8String value
;
46 * true if the cookie is a domain cookie, false otherwise
48 readonly attribute
boolean isDomain
;
51 * the host (possibly fully qualified) of the cookie
53 readonly attribute AUTF8String host
;
56 * the host (possibly fully qualified) of the cookie,
57 * without a leading dot to represent if it is a
60 readonly attribute AUTF8String rawHost
;
63 * the path pertaining to the cookie
65 readonly attribute AUTF8String path
;
68 * true if the cookie was transmitted over ssl, false otherwise
70 readonly attribute
boolean isSecure
;
73 * @DEPRECATED use nsICookie.expiry and nsICookie.isSession instead.
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.
79 readonly attribute uint64_t expires
;
82 * the actual expiry time of the cookie, in seconds
83 * since midnight (00:00:00), January 1, 1970 UTC.
85 * this is distinct from nsICookie::expires, which
86 * has different and obsolete semantics.
88 readonly attribute int64_t expiry
;
91 * The origin attributes for this cookie
94 readonly attribute jsval originAttributes
;
97 * Native getter for origin attributes
99 [noscript
, notxpcom
, nostdcall
, binaryname
(OriginAttributesNative
)]
100 const_OriginAttributes OriginAttributesNative
();
102 [noscript
, notxpcom
, nostdcall
, binaryname
(AsCookie
)]
103 const_Cookie AsCookie
();
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.
111 readonly attribute
boolean isSession
;
114 * true if the cookie is an http only cookie
116 readonly attribute
boolean isHttpOnly
;
119 * the creation time of the cookie, in microseconds
120 * since midnight (00:00:00), January 1, 1970 UTC.
122 readonly attribute int64_t creationTime
;
125 * the last time the cookie was accessed (i.e. created,
126 * modified, or read by the server), in microseconds
127 * since midnight (00:00:00), January 1, 1970 UTC.
129 * note that this time may be approximate.
131 readonly attribute int64_t lastAccessed
;
134 * the SameSite attribute; this controls the cookie behavior for cross-site
136 * https://tools.ietf.org/html/draft-west-first-party-cookies-07
138 * This should be one of:
139 * - SAMESITE_NONE - the SameSite attribute is not present
140 * - SAMESITE_LAX - the SameSite attribute is present, but not strict
141 * - SAMESITE_STRICT - the SameSite attribute is present and strict
143 readonly attribute int32_t sameSite
;
146 * The list of possible schemes of cookies. It's a bitmap because a cookie
147 * can be set on HTTP and HTTPS. At the moment, we treat it as the same
150 cenum schemeType
: 8 {
160 readonly attribute nsICookie_schemeType schemeMap
;