mirror of
https://github.com/servo/servo.git
synced 2025-09-30 00:29:14 +01:00
script: initial CookieStore implementation (#37968)
This is a first draft at implementing the required infrastructure for CookieStore, which requires setting up IPC between script and the resource thread to allow for async/"in parallel" handling of cookie changes that have a promise API. Cookie Store also will need to receive change events when cookies for a url are changed so the architecture needs to support that. Expect this PR to be reworked once the architecture becomes more settled, cookie change events will be implemented in follow up PRs Testing: WPT tests exist for this API Part of #37674 --------- Signed-off-by: Sebastian C <sebsebmc@gmail.com>
This commit is contained in:
parent
a75f3fd09b
commit
b869b7eb96
35 changed files with 917 additions and 305 deletions
|
@ -100,6 +100,10 @@ DOMInterfaces = {
|
|||
'canGc': ['Types']
|
||||
},
|
||||
|
||||
'CookieStore': {
|
||||
'canGc': ['Set', 'Set_', 'Get', 'Get_', 'GetAll', 'GetAll_', 'Delete', 'Delete_']
|
||||
},
|
||||
|
||||
'CountQueuingStrategy': {
|
||||
'canGc': ['GetSize'],
|
||||
},
|
||||
|
@ -655,7 +659,7 @@ DOMInterfaces = {
|
|||
},
|
||||
|
||||
'Window': {
|
||||
'canGc': ['Stop', 'Fetch', 'Stop', 'Fetch', 'Open', 'CreateImageBitmap', 'CreateImageBitmap_', 'SetInterval', 'SetTimeout', 'TrustedTypes', 'WebdriverCallback', 'WebdriverException'],
|
||||
'canGc': ['CreateImageBitmap', 'CreateImageBitmap_', 'CookieStore', 'Fetch', 'Open', 'SetInterval', 'SetTimeout', 'Stop', 'TrustedTypes', 'WebdriverCallback', 'WebdriverException'],
|
||||
'inRealms': ['Fetch', 'GetOpener', 'WebdriverCallback', 'WebdriverException'],
|
||||
'additionalTraits': ['crate::interfaces::WindowHelpers'],
|
||||
},
|
||||
|
|
71
components/script_bindings/webidls/CookieStore.webidl
Normal file
71
components/script_bindings/webidls/CookieStore.webidl
Normal file
|
@ -0,0 +1,71 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// https://cookiestore.spec.whatwg.org/
|
||||
|
||||
[Exposed=(ServiceWorker,Window),
|
||||
SecureContext,
|
||||
Pref="dom_cookiestore_enabled"]
|
||||
interface CookieStore : EventTarget {
|
||||
Promise<CookieListItem?> get(USVString name);
|
||||
Promise<CookieListItem?> get(optional CookieStoreGetOptions options = {});
|
||||
|
||||
Promise<CookieList> getAll(USVString name);
|
||||
Promise<CookieList> getAll(optional CookieStoreGetOptions options = {});
|
||||
|
||||
Promise<undefined> set(USVString name, USVString value);
|
||||
Promise<undefined> set(CookieInit options);
|
||||
|
||||
Promise<undefined> delete(USVString name);
|
||||
Promise<undefined> delete(CookieStoreDeleteOptions options);
|
||||
|
||||
// [Exposed=Window]
|
||||
// attribute EventHandler onchange;
|
||||
};
|
||||
|
||||
dictionary CookieStoreGetOptions {
|
||||
USVString name;
|
||||
USVString url;
|
||||
};
|
||||
|
||||
enum CookieSameSite {
|
||||
"strict",
|
||||
"lax",
|
||||
"none"
|
||||
};
|
||||
|
||||
dictionary CookieInit {
|
||||
required USVString name;
|
||||
required USVString value;
|
||||
DOMHighResTimeStamp? expires = null;
|
||||
USVString? domain = null;
|
||||
USVString path = "/";
|
||||
CookieSameSite sameSite = "strict";
|
||||
boolean partitioned = false;
|
||||
};
|
||||
|
||||
dictionary CookieStoreDeleteOptions {
|
||||
required USVString name;
|
||||
USVString? domain = null;
|
||||
USVString path = "/";
|
||||
boolean partitioned = false;
|
||||
};
|
||||
|
||||
dictionary CookieListItem {
|
||||
USVString name;
|
||||
USVString value;
|
||||
USVString? domain;
|
||||
USVString path;
|
||||
DOMHighResTimeStamp? expires;
|
||||
boolean secure;
|
||||
CookieSameSite sameSite;
|
||||
boolean partitioned;
|
||||
};
|
||||
|
||||
typedef sequence<CookieListItem> CookieList;
|
||||
|
||||
[SecureContext]
|
||||
partial interface Window {
|
||||
[SameObject, Pref="dom_cookiestore_enabled"] readonly attribute CookieStore cookieStore;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue