// https://github.com/WICG/cookie-store/blob/gh-pages/explainer.md enum CookieSameSite { "strict", "lax", "unrestricted" }; dictionary CookieListItem { required USVString name; USVString value; USVString? domain = null; USVString path = "/"; DOMTimeStamp? expires = null; boolean secure = true; CookieSameSite sameSite = "strict"; }; typedef sequence CookieList; dictionary CookieChangeEventInit : EventInit { CookieList changed; CookieList deleted; }; [ Exposed=Window, SecureContext, Constructor(DOMString type, optional CookieChangeEventInit eventInitDict) ] interface CookieChangeEvent : Event { readonly attribute CookieList changed; readonly attribute CookieList deleted; }; dictionary ExtendableCookieChangeEventInit : ExtendableEventInit { CookieList changed; CookieList deleted; }; [ Exposed=ServiceWorker, Constructor(DOMString type, optional ExtendableCookieChangeEventInit eventInitDict) ] interface ExtendableCookieChangeEvent : ExtendableEvent { readonly attribute CookieList changed; readonly attribute CookieList deleted; }; enum CookieMatchType { "equals", "starts-with" }; dictionary CookieStoreDeleteOptions { required USVString name; USVString? domain = null; USVString path = "/"; boolean secure = true; CookieSameSite sameSite = "strict"; }; dictionary CookieStoreGetOptions { USVString name; USVString url; CookieMatchType matchType = "equals"; }; dictionary CookieStoreSetOptions { DOMTimeStamp? expires = null; USVString? domain = null; USVString path = "/"; boolean secure = true; CookieSameSite sameSite = "strict"; }; dictionary CookieStoreSetExtraOptions : CookieStoreSetOptions { required USVString name; required USVString value; }; [ Exposed=(ServiceWorker,Window), SecureContext ] interface CookieStore : EventTarget { Promise get(USVString name); Promise get(optional CookieStoreGetOptions options); Promise getAll(USVString name); Promise getAll(optional CookieStoreGetOptions options); Promise set(USVString name, USVString value, optional CookieStoreSetOptions options); Promise set(CookieStoreSetExtraOptions options); Promise delete(USVString name); Promise delete(CookieStoreDeleteOptions options); [Exposed=ServiceWorker] Promise subscribeToChanges(sequence subscriptions); [Exposed=ServiceWorker] Promise> getChangeSubscriptions(); [Exposed=Window] attribute EventHandler onchange; }; [SecureContext] partial interface Window { [Replaceable, SameObject] readonly attribute CookieStore cookieStore; }; partial interface ServiceWorkerGlobalScope { [Replaceable, SameObject] readonly attribute CookieStore cookieStore; attribute EventHandler oncookiechange; };