blob: 63ddc09077836902d87780b1797a5b3719632476 [file] [log] [blame]
// https://github.com/WICG/cookie-store/blob/gh-pages/explainer.md
enum CookieSameSite {
"strict",
"lax",
"unrestricted"
};
dictionary CookieListItem {
USVString name;
USVString value;
USVString? domain;
USVString path;
DOMTimeStamp? expires;
boolean secure;
CookieSameSite sameSite;
};
typedef sequence<CookieListItem> 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 CookieStoreGetOptions {
USVString name;
USVString url;
CookieMatchType matchType = "equals";
};
dictionary CookieStoreSetOptions {
USVString name;
USVString value;
DOMTimeStamp? expires = null;
USVString domain;
USVString path = "/";
boolean secure = true;
boolean httpOnly = false;
CookieSameSite sameSite = "strict";
};
[
Exposed=(ServiceWorker,Window),
SecureContext
] interface CookieStore : EventTarget {
Promise<CookieList?> getAll(USVString name, optional CookieStoreGetOptions options);
Promise<CookieList?> getAll(optional CookieStoreGetOptions options);
Promise<CookieListItem?> get(USVString name, optional CookieStoreGetOptions options);
Promise<CookieListItem?> get(optional CookieStoreGetOptions options);
Promise<void> set(USVString name, USVString value, optional CookieStoreSetOptions options);
Promise<void> set(CookieStoreSetOptions options);
Promise<void> delete(USVString name, optional CookieStoreSetOptions options);
Promise<void> delete(CookieStoreSetOptions options);
[Exposed=ServiceWorker] Promise<void> subscribeToChanges(sequence<CookieStoreGetOptions> subscriptions);
[Exposed=ServiceWorker] Promise<sequence<CookieStoreGetOptions>> 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;
};