summaryrefslogtreecommitdiffstats
path: root/toolkit/components/extensions/schemas/cookies.json
blob: b1c6b02a458728470acc24738ce411fe1634244f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

[
  {
    "namespace": "manifest",
    "types": [
      {
        "$extend": "OptionalPermissionNoPrompt",
        "choices": [
          {
            "type": "string",
            "enum": ["cookies"]
          }
        ]
      }
    ]
  },
  {
    "namespace": "cookies",
    "description": "Use the <code>browser.cookies</code> API to query and modify cookies, and to be notified when they change.",
    "permissions": ["cookies"],
    "types": [
      {
        "id": "SameSiteStatus",
        "type": "string",
        "enum": ["no_restriction", "lax", "strict"],
        "description": "A cookie's 'SameSite' state (https://tools.ietf.org/html/draft-west-first-party-cookies). 'no_restriction' corresponds to a cookie set without a 'SameSite' attribute, 'lax' to 'SameSite=Lax', and 'strict' to 'SameSite=Strict'."
      },
      {
        "id": "PartitionKey",
        "type": "object",
        "description": "The description of the storage partition of a cookie. This object may be omitted (null) if a cookie is not partitioned.",
        "properties": {
          "topLevelSite": {
            "type": "string",
            "optional": true,
            "description": "The first-party URL of the cookie, if the cookie is in storage partitioned by the top-level site."
          }
        }
      },
      {
        "id": "Cookie",
        "type": "object",
        "description": "Represents information about an HTTP cookie.",
        "properties": {
          "name": {
            "type": "string",
            "description": "The name of the cookie."
          },
          "value": {
            "type": "string",
            "description": "The value of the cookie."
          },
          "domain": {
            "type": "string",
            "description": "The domain of the cookie (e.g. \"www.google.com\", \"example.com\")."
          },
          "hostOnly": {
            "type": "boolean",
            "description": "True if the cookie is a host-only cookie (i.e. a request's host must exactly match the domain of the cookie)."
          },
          "path": {
            "type": "string",
            "description": "The path of the cookie."
          },
          "secure": {
            "type": "boolean",
            "description": "True if the cookie is marked as Secure (i.e. its scope is limited to secure channels, typically HTTPS)."
          },
          "httpOnly": {
            "type": "boolean",
            "description": "True if the cookie is marked as HttpOnly (i.e. the cookie is inaccessible to client-side scripts)."
          },
          "sameSite": {
            "$ref": "SameSiteStatus",
            "description": "The cookie's same-site status (i.e. whether the cookie is sent with cross-site requests)."
          },
          "session": {
            "type": "boolean",
            "description": "True if the cookie is a session cookie, as opposed to a persistent cookie with an expiration date."
          },
          "expirationDate": {
            "type": "number",
            "optional": true,
            "description": "The expiration date of the cookie as the number of seconds since the UNIX epoch. Not provided for session cookies."
          },
          "storeId": {
            "type": "string",
            "description": "The ID of the cookie store containing this cookie, as provided in getAllCookieStores()."
          },
          "firstPartyDomain": {
            "type": "string",
            "description": "The first-party domain of the cookie."
          },
          "partitionKey": {
            "$ref": "PartitionKey",
            "optional": true,
            "description": "The cookie's storage partition, if any. null if not partitioned."
          }
        }
      },
      {
        "id": "CookieStore",
        "type": "object",
        "description": "Represents a cookie store in the browser. An incognito mode window, for instance, uses a separate cookie store from a non-incognito window.",
        "properties": {
          "id": {
            "type": "string",
            "description": "The unique identifier for the cookie store."
          },
          "tabIds": {
            "type": "array",
            "items": { "type": "integer" },
            "description": "Identifiers of all the browser tabs that share this cookie store."
          },
          "incognito": {
            "type": "boolean",
            "description": "Indicates if this is an incognito cookie store"
          }
        }
      },
      {
        "id": "OnChangedCause",
        "type": "string",
        "enum": [
          "evicted",
          "expired",
          "explicit",
          "expired_overwrite",
          "overwrite"
        ],
        "description": "The underlying reason behind the cookie's change. If a cookie was inserted, or removed via an explicit call to $(ref: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."
      }
    ],
    "functions": [
      {
        "name": "get",
        "type": "function",
        "description": "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.",
        "async": "callback",
        "parameters": [
          {
            "type": "object",
            "name": "details",
            "description": "Details to identify the cookie being retrieved.",
            "properties": {
              "url": {
                "type": "string",
                "description": "The URL with which the cookie to retrieve is associated. This argument may be a full URL, in which case any data following the URL path (e.g. the query string) is simply ignored. If host permissions for this URL are not specified in the manifest file, the API call will fail."
              },
              "name": {
                "type": "string",
                "description": "The name of the cookie to retrieve."
              },
              "storeId": {
                "type": "string",
                "optional": true,
                "description": "The ID of the cookie store in which to look for the cookie. By default, the current execution context's cookie store will be used."
              },
              "firstPartyDomain": {
                "type": "string",
                "optional": true,
                "description": "The first-party domain which the cookie to retrieve is associated. This attribute is required if First-Party Isolation is enabled."
              },
              "partitionKey": {
                "$ref": "PartitionKey",
                "optional": true,
                "description": "The storage partition, if the cookie is part of partitioned storage. By default, only non-partitioned cookies are returned."
              }
            }
          },
          {
            "type": "function",
            "name": "callback",
            "parameters": [
              {
                "name": "cookie",
                "$ref": "Cookie",
                "optional": true,
                "description": "Contains details about the cookie. This parameter is null if no such cookie was found."
              }
            ]
          }
        ]
      },
      {
        "name": "getAll",
        "type": "function",
        "description": "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.",
        "async": "callback",
        "parameters": [
          {
            "type": "object",
            "name": "details",
            "description": "Information to filter the cookies being retrieved.",
            "properties": {
              "url": {
                "type": "string",
                "optional": true,
                "description": "Restricts the retrieved cookies to those that would match the given URL."
              },
              "name": {
                "type": "string",
                "optional": true,
                "description": "Filters the cookies by name."
              },
              "domain": {
                "type": "string",
                "optional": true,
                "description": "Restricts the retrieved cookies to those whose domains match or are subdomains of this one."
              },
              "path": {
                "type": "string",
                "optional": true,
                "description": "Restricts the retrieved cookies to those whose path exactly matches this string."
              },
              "secure": {
                "type": "boolean",
                "optional": true,
                "description": "Filters the cookies by their Secure property."
              },
              "session": {
                "type": "boolean",
                "optional": true,
                "description": "Filters out session vs. persistent cookies."
              },
              "storeId": {
                "type": "string",
                "optional": true,
                "description": "The cookie store to retrieve cookies from. If omitted, the current execution context's cookie store will be used."
              },
              "firstPartyDomain": {
                "type": "string",
                "optional": "omit-key-if-missing",
                "description": "Restricts the retrieved cookies to those whose first-party domains match this one. This attribute is required if First-Party Isolation is enabled. To not filter by a specific first-party domain, use `null` or `undefined`."
              },
              "partitionKey": {
                "$ref": "PartitionKey",
                "optional": true,
                "description": "Selects a specific storage partition to look up cookies. Defaults to null, in which case only non-partitioned cookies are retrieved. If an object iis passed, partitioned cookies are also included, and filtered based on the keys present in the given PartitionKey description. An empty object ({}) returns all cookies (partitioned + unpartitioned), a non-empty object (e.g. {topLevelSite: '...'}) only returns cookies whose partition match all given attributes."
              }
            }
          },
          {
            "type": "function",
            "name": "callback",
            "parameters": [
              {
                "name": "cookies",
                "type": "array",
                "items": { "$ref": "Cookie" },
                "description": "All the existing, unexpired cookies that match the given cookie info."
              }
            ]
          }
        ]
      },
      {
        "name": "set",
        "type": "function",
        "description": "Sets a cookie with the given cookie data; may overwrite equivalent cookies if they exist.",
        "async": "callback",
        "parameters": [
          {
            "type": "object",
            "name": "details",
            "description": "Details about the cookie being set.",
            "properties": {
              "url": {
                "type": "string",
                "description": "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."
              },
              "name": {
                "type": "string",
                "optional": true,
                "description": "The name of the cookie. Empty by default if omitted."
              },
              "value": {
                "type": "string",
                "optional": true,
                "description": "The value of the cookie. Empty by default if omitted."
              },
              "domain": {
                "type": "string",
                "optional": true,
                "description": "The domain of the cookie. If omitted, the cookie becomes a host-only cookie."
              },
              "path": {
                "type": "string",
                "optional": true,
                "description": "The path of the cookie. Defaults to the path portion of the url parameter."
              },
              "secure": {
                "type": "boolean",
                "optional": true,
                "description": "Whether the cookie should be marked as Secure. Defaults to false."
              },
              "httpOnly": {
                "type": "boolean",
                "optional": true,
                "description": "Whether the cookie should be marked as HttpOnly. Defaults to false."
              },
              "sameSite": {
                "$ref": "SameSiteStatus",
                "optional": true,
                "description": "The cookie's same-site status.",
                "default": "no_restriction"
              },
              "expirationDate": {
                "type": "number",
                "optional": true,
                "description": "The expiration date of the cookie as the number of seconds since the UNIX epoch. If omitted, the cookie becomes a session cookie."
              },
              "storeId": {
                "type": "string",
                "optional": true,
                "description": "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."
              },
              "firstPartyDomain": {
                "type": "string",
                "optional": true,
                "description": "The first-party domain of the cookie. This attribute is required if First-Party Isolation is enabled."
              },
              "partitionKey": {
                "$ref": "PartitionKey",
                "optional": true,
                "description": "The storage partition, if the cookie is part of partitioned storage. By default, non-partitioned storage is used."
              }
            }
          },
          {
            "type": "function",
            "name": "callback",
            "optional": true,
            "parameters": [
              {
                "name": "cookie",
                "$ref": "Cookie",
                "optional": true,
                "description": "Contains details about the cookie that's been set.  If setting failed for any reason, this will be \"null\", and $(ref:runtime.lastError) will be set."
              }
            ]
          }
        ]
      },
      {
        "name": "remove",
        "type": "function",
        "description": "Deletes a cookie by name.",
        "async": "callback",
        "parameters": [
          {
            "type": "object",
            "name": "details",
            "description": "Information to identify the cookie to remove.",
            "properties": {
              "url": {
                "type": "string",
                "description": "The URL associated with the cookie. If host permissions for this URL are not specified in the manifest file, the API call will fail."
              },
              "name": {
                "type": "string",
                "description": "The name of the cookie to remove."
              },
              "storeId": {
                "type": "string",
                "optional": true,
                "description": "The ID of the cookie store to look in for the cookie. If unspecified, the cookie is looked for by default in the current execution context's cookie store."
              },
              "firstPartyDomain": {
                "type": "string",
                "optional": true,
                "description": "The first-party domain associated with the cookie. This attribute is required if First-Party Isolation is enabled."
              },
              "partitionKey": {
                "$ref": "PartitionKey",
                "optional": true,
                "description": "The storage partition, if the cookie is part of partitioned storage. By default, non-partitioned storage is used."
              }
            }
          },
          {
            "type": "function",
            "name": "callback",
            "optional": true,
            "parameters": [
              {
                "name": "details",
                "type": "object",
                "description": "Contains details about the cookie that's been removed.  If removal failed for any reason, this will be \"null\", and $(ref:runtime.lastError) will be set.",
                "optional": true,
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "The URL associated with the cookie that's been removed."
                  },
                  "name": {
                    "type": "string",
                    "description": "The name of the cookie that's been removed."
                  },
                  "storeId": {
                    "type": "string",
                    "description": "The ID of the cookie store from which the cookie was removed."
                  },
                  "firstPartyDomain": {
                    "type": "string",
                    "description": "The first-party domain associated with the cookie that's been removed."
                  },
                  "partitionKey": {
                    "$ref": "PartitionKey",
                    "optional": true,
                    "description": "The storage partition, if the cookie is part of partitioned storage. null if not partitioned."
                  }
                }
              }
            ]
          }
        ]
      },
      {
        "name": "getAllCookieStores",
        "type": "function",
        "description": "Lists all existing cookie stores.",
        "async": "callback",
        "parameters": [
          {
            "type": "function",
            "name": "callback",
            "parameters": [
              {
                "name": "cookieStores",
                "type": "array",
                "items": { "$ref": "CookieStore" },
                "description": "All the existing cookie stores."
              }
            ]
          }
        ]
      }
    ],
    "events": [
      {
        "name": "onChanged",
        "type": "function",
        "description": "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\".",
        "parameters": [
          {
            "type": "object",
            "name": "changeInfo",
            "properties": {
              "removed": {
                "type": "boolean",
                "description": "True if a cookie was removed."
              },
              "cookie": {
                "$ref": "Cookie",
                "description": "Information about the cookie that was set or removed."
              },
              "cause": {
                "$ref": "OnChangedCause",
                "description": "The underlying reason behind the cookie's change."
              }
            }
          }
        ]
      }
    ]
  }
]