Bug 1947894 - CookieStore SW support - part 3 - webidl, r=smaug,asuth,edgul

Differential Revision: https://phabricator.services.mozilla.com/D238511
This commit is contained in:
Andrea Marchesini
2025-03-25 21:51:49 +00:00
parent dc4a1be4d8
commit 0f1965bbee
6 changed files with 64 additions and 9 deletions

View File

@@ -0,0 +1,27 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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 http://mozilla.org/MPL/2.0/.
*
* The origin of this IDL file is
* https://wicg.github.io/cookie-store/#idl-index
*
* Copyright © 2024 the Contributors to the Cookie Store API Specification,
* published by the Web Platform Incubator Community Group under the W3C
* Community Contributor License Agreement (CLA). A human-readable summary is
* available.
*/
[Exposed=(ServiceWorker,Window),
SecureContext,
Pref="dom.cookieStore.manager.enabled"]
interface CookieStoreManager {
[Throws]
Promise<undefined> subscribe(sequence<CookieStoreGetOptions> subscriptions);
[Throws]
Promise<sequence<CookieStoreGetOptions>> getSubscriptions();
[Throws]
Promise<undefined> unsubscribe(sequence<CookieStoreGetOptions> subscriptions);
};

View File

@@ -0,0 +1,25 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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 http://mozilla.org/MPL/2.0/.
*
* The origin of this IDL file is:
* https://wicg.github.io/cookie-store/#ExtendableCookieChangeEvent
*/
[Exposed=ServiceWorker, Pref="dom.cookieStore.manager.enabled"]
interface ExtendableCookieChangeEvent : ExtendableEvent {
constructor(DOMString type, optional ExtendableCookieChangeEventInit eventInitDict = {});
// TODO: Use FrozenArray once available. (Bug 1236777)
// [SameObject] readonly attribute FrozenArray<CookieListItem> changed;
// [SameObject] readonly attribute FrozenArray<CookieListItem> deleted;
[Frozen, Cached, Constant]
readonly attribute sequence<CookieListItem> changed;
[Frozen, Cached, Constant]
readonly attribute sequence<CookieListItem> deleted;
};
dictionary ExtendableCookieChangeEventInit : ExtendableEventInit {
CookieList changed;
CookieList deleted;
};

View File

@@ -53,8 +53,6 @@ ServiceWorkerGlobalScope includes ExtensionGlobalsMixin;
partial interface ServiceWorkerGlobalScope {
[SameObject, Pref="dom.cookieStore.enabled"] readonly attribute CookieStore cookieStore;
/* Bug 1475599 - We decide to do not implement the entire cookie-store spec.
* Instead, we implement only the subset that is compatible with document.cookie
attribute EventHandler oncookiechange;
*/
[Pref="dom.cookieStore.manager.enabled"]
attribute EventHandler oncookiechange;
};

View File

@@ -54,10 +54,7 @@ partial interface ServiceWorkerRegistration {
Promise<sequence<Notification>> getNotifications(optional GetNotificationOptions filter = {});
};
/* Bug 1475599 - We decide to do not implement the entire cookie-store spec.
* Instead, we implement only the subset that is compatible with document.cookie
[Exposed=(ServiceWorker,Window)]
partial interface ServiceWorkerRegistration {
[SameObject] readonly attribute CookieStoreManager cookies;
[Throws, SameObject, Exposed=(ServiceWorker,Window), Pref="dom.cookieStore.manager.enabled"]
readonly attribute CookieStoreManager cookies;
};
*/

View File

@@ -485,6 +485,7 @@ WEBIDL_FILES = [
"ConvolverNode.webidl",
"CookieChangeEvent.webidl",
"CookieStore.webidl",
"CookieStoreManager.webidl",
"CreateOfferRequest.webidl",
"CredentialManagement.webidl",
"Crypto.webidl",
@@ -560,6 +561,7 @@ WEBIDL_FILES = [
"EventListener.webidl",
"EventSource.webidl",
"EventTarget.webidl",
"ExtendableCookieChangeEvent.webidl",
"ExtendableEvent.webidl",
"ExtendableMessageEvent.webidl",
"External.webidl",

View File

@@ -2543,6 +2543,12 @@
value: @IS_NIGHTLY_BUILD@
mirror: always
# Disable cookie-store manager API
- name: dom.cookieStore.manager.enabled
type: RelaxedAtomicBool
value: false
mirror: always
# Is support for CSSPseudoElement enabled?
- name: dom.css_pseudo_element.enabled
type: bool