You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: types/chrome/index.d.ts
+66-72Lines changed: 66 additions & 72 deletions
Original file line number
Diff line number
Diff line change
@@ -2086,7 +2086,12 @@ declare namespace chrome {
2086
2086
*/
2087
2087
export namespace cookies {
2088
2088
/** A cookie's 'SameSite' state (https://tools.ietf.org/html/draft-west-first-party-cookies). 'no_restriction' corresponds to a cookie set with 'SameSite=None', 'lax' to 'SameSite=Lax', and 'strict' to 'SameSite=Strict'. 'unspecified' corresponds to a cookie set without the SameSite attribute. **/
* The cookie's same-site status (i.e. whether the cookie is sent with cross-site requests).
2120
2125
* @since Chrome 51
2121
2126
*/
2122
-
sameSite: SameSiteStatus;
2127
+
sameSite: `${SameSiteStatus}`;
2123
2128
}
2124
2129
2125
-
/** Represents a partitioned cookie's partition key. */
2130
+
/**
2131
+
* Represents a partitioned cookie's partition key.
2132
+
* @since Chrome 119
2133
+
*/
2126
2134
export interface CookiePartitionKey {
2127
2135
/**
2128
2136
* Indicates if the cookie was set in a cross-cross site context. This prevents a top-level site embedded in a cross-site context from accessing cookies set by the top-level site in a same-site context.
/** The request-URI to associate with the setting of the cookie. This value can affect the default domain and path values of the created cookie. If host permissions for this URL are not specified in the manifest file, the API call will fail. */
2177
2185
url: string;
2178
-
/** Optional. The ID of the cookie store in which to set the cookie. By default, the cookie is set in the current execution context's cookie store. */
2186
+
/** The ID of the cookie store in which to set the cookie. By default, the cookie is set in the current execution context's cookie store. */
2179
2187
storeId?: string | undefined;
2180
-
/** Optional. The value of the cookie. Empty by default if omitted. */
2188
+
/** The value of the cookie. Empty by default if omitted. */
2181
2189
value?: string | undefined;
2182
-
/** Optional. The expiration date of the cookie as the number of seconds since the UNIX epoch. If omitted, the cookie becomes a session cookie. */
2190
+
/** The expiration date of the cookie as the number of seconds since the UNIX epoch. If omitted, the cookie becomes a session cookie. */
2183
2191
expirationDate?: number | undefined;
2184
-
/** Optional. The path of the cookie. Defaults to the path portion of the url parameter. */
2192
+
/** The path of the cookie. Defaults to the path portion of the url parameter. */
2185
2193
path?: string | undefined;
2186
-
/** Optional. Whether the cookie should be marked as HttpOnly. Defaults to false. */
2194
+
/** Whether the cookie should be marked as HttpOnly. Defaults to false. */
2187
2195
httpOnly?: boolean | undefined;
2188
-
/** Optional. Whether the cookie should be marked as Secure. Defaults to false. */
2196
+
/** Whether the cookie should be marked as Secure. Defaults to false. */
2189
2197
secure?: boolean | undefined;
2190
2198
/**
2191
-
* Optional. The cookie's same-site status. Defaults to "unspecified", i.e., if omitted, the cookie is set without specifying a SameSite attribute.
2199
+
* The cookie's same-site status. Defaults to "unspecified", i.e., if omitted, the cookie is set without specifying a SameSite attribute.
2192
2200
* @since Chrome 51
2193
2201
*/
2194
-
sameSite?: SameSiteStatus | undefined;
2202
+
sameSite?: `${SameSiteStatus}` | undefined;
2195
2203
}
2196
2204
2197
-
/** Details to identify the cookie. */
2205
+
/**
2206
+
* Details to identify the cookie.
2207
+
* @since Chrome 88
2208
+
*/
2198
2209
export interface CookieDetails {
2199
2210
/** The name of the cookie to access. */
2200
2211
name: string;
@@ -2214,11 +2225,8 @@ declare namespace chrome {
2214
2225
cookie: Cookie;
2215
2226
/** True if a cookie was removed. */
2216
2227
removed: boolean;
2217
-
/**
2218
-
* @since Chrome 12
2219
-
* The underlying reason behind the cookie's change.
2220
-
*/
2221
-
cause: string;
2228
+
/** The underlying reason behind the cookie's change. */
/** The unique identifier for the document. If the frameId and/or tabId are provided they will be validated to match the document found by provided document ID. */
2230
-
documentId?: string;
2238
+
documentId?: string | undefined;
2231
2239
/** The unique identifier for the frame within the tab. */
2232
-
frameId?: number;
2240
+
frameId?: number | undefined;
2233
2241
/* The unique identifier for the tab containing the frame. */
* Parameter cookieStores: All the existing cookie stores.
2246
+
* The underlying reason behind the cookie's change. If a cookie was inserted, or removed via an explicit call to "chrome.cookies.remove", "cause" will be "explicit". If a cookie was automatically removed due to expiry, "cause" will be "expired". If a cookie was removed due to being overwritten with an already-expired expiration date, "cause" will be set to "expired_overwrite". If a cookie was automatically removed due to garbage collection, "cause" will be "evicted". If a cookie was automatically removed due to a "set" call that overwrote it, "cause" will be "overwrite". Plan your response accordingly.
2247
+
* @since Chrome 44
2242
2248
*/
2243
-
export function getAllCookieStores(callback: (cookieStores: CookieStore[]) => void): void;
2249
+
export enum OnChangedCause {
2250
+
EVICTED = "evicted",
2251
+
EXPIRED = "expired",
2252
+
EXPLICIT = "explicit",
2253
+
EXPIRED_OVERWRITE = "expired_overwrite",
2254
+
OVERWRITE = "overwrite",
2255
+
}
2244
2256
2245
2257
/**
2246
2258
* Lists all existing cookie stores.
2247
-
* @return The `getAllCookieStores` method provides its result via callback or returned as a `Promise` (MV3 only).
2259
+
*
2260
+
* Can return its result via Promise in Manifest V3 or later.
2248
2261
*/
2249
2262
export function getAllCookieStores(): Promise<CookieStore[]>;
2263
+
export function getAllCookieStores(callback: (cookieStores: CookieStore[]) => void): void;
2250
2264
2251
2265
/**
2252
2266
* The partition key for the frame indicated.
2253
-
* Can return its result via Promise in Manifest V3
2267
+
*
2268
+
* Can return its result via Promise in Manifest V3 or later.
2254
2269
* @since Chrome 132
2255
2270
*/
2256
2271
export function getPartitionKey(details: FrameDetails): Promise<{ partitionKey: CookiePartitionKey }>;
* Retrieves all cookies from a single cookie store that match the given information. The cookies returned will be sorted, with those with the longest path first. If multiple cookies have the same path length, those with the earliest creation time will be first.
2264
-
* @param details Information to filter the cookies being retrieved.
2265
-
* Parameter cookies: All the existing, unexpired cookies that match the given cookie info.
2266
-
*/
2267
-
export function getAll(details: GetAllDetails, callback: (cookies: Cookie[]) => void): void;
2268
-
2269
-
/**
2270
-
* Retrieves all cookies from a single cookie store that match the given information. The cookies returned will be sorted, with those with the longest path first. If multiple cookies have the same path length, those with the earliest creation time will be first.
2271
-
* @param details Information to filter the cookies being retrieved.
2272
-
* @return The `getAll` method provides its result via callback or returned as a `Promise` (MV3 only).
2278
+
* Retrieves all cookies from a single cookie store that match the given information. The cookies returned will be sorted, with those with the longest path first. If multiple cookies have the same path length, those with the earliest creation time will be first. This method only retrieves cookies for domains that the extension has host permissions to
2279
+
* @param details Information to identify the cookie to remove.
2280
+
*
2281
+
* Can return its result via Promise in Manifest V3 or later.
2273
2282
*/
2274
2283
export function getAll(details: GetAllDetails): Promise<Cookie[]>;
2284
+
export function getAll(details: GetAllDetails, callback: (cookies: Cookie[]) => void): void;
2275
2285
2276
2286
/**
2277
2287
* Sets a cookie with the given cookie data; may overwrite equivalent cookies if they exist.
2278
2288
* @param details Details about the cookie being set.
2279
-
* @return The `set` method provides its result via callback or returned as a `Promise` (MV3 only).
2289
+
*
2290
+
* Can return its result via Promise in Manifest V3 or later.
2280
2291
*/
2281
2292
export function set(details: SetDetails): Promise<Cookie | null>;
2282
-
2283
-
/**
2284
-
* Sets a cookie with the given cookie data; may overwrite equivalent cookies if they exist.
2285
-
* @param details Details about the cookie being set.
2286
-
* Optional parameter cookie: Contains details about the cookie that's been set. If setting failed for any reason, this will be "null", and "chrome.runtime.lastError" will be set.
* @param details Information to identify the cookie to remove.
2293
-
* @return The `remove` method provides its result via callback or returned as a `Promise` (MV3 only).
2297
+
*
2298
+
* Can return its result via Promise in Manifest V3 or later.
2294
2299
*/
2295
2300
export function remove(details: CookieDetails): Promise<CookieDetails>;
2296
-
2297
-
/**
2298
-
* Deletes a cookie by name.
2299
-
* @param details Information to identify the cookie to remove.
2300
-
*/
2301
2301
export function remove(details: CookieDetails, callback?: (details: CookieDetails) => void): void;
2302
2302
2303
2303
/**
2304
2304
* Retrieves information about a single cookie. If more than one cookie of the same name exists for the given URL, the one with the longest path will be returned. For cookies with the same path length, the cookie with the earliest creation time will be returned.
2305
-
* @param details Details to identify the cookie being retrieved.
2306
-
* Parameter cookie: Contains details about the cookie. This parameter is null if no such cookie was found.
* Retrieves information about a single cookie. If more than one cookie of the same name exists for the given URL, the one with the longest path will be returned. For cookies with the same path length, the cookie with the earliest creation time will be returned.
2312
-
* @param details Details to identify the cookie being retrieved.
2313
-
* @return The `get` method provides its result via callback or returned as a `Promise` (MV3 only).
2305
+
*
2306
+
* Can return its result via Promise in Manifest V3 or later.
2314
2307
*/
2315
2308
export function get(details: CookieDetails): Promise<Cookie | null>;
/** Fired when a cookie is set or removed. As a special case, note that updating a cookie's properties is implemented as a two step process: the cookie to be updated is first removed entirely, generating a notification with "cause" of "overwrite" . Afterwards, a new cookie is written with the updated values, generating a second notification with "cause" "explicit". */
0 commit comments