From 0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:47:29 +0200 Subject: Adding upstream version 115.8.0esr. Signed-off-by: Daniel Baumann --- .../tests/interfaces/service-workers.idl | 240 +++++++++++++++++++++ 1 file changed, 240 insertions(+) create mode 100644 testing/web-platform/tests/interfaces/service-workers.idl (limited to 'testing/web-platform/tests/interfaces/service-workers.idl') diff --git a/testing/web-platform/tests/interfaces/service-workers.idl b/testing/web-platform/tests/interfaces/service-workers.idl new file mode 100644 index 0000000000..6d44d61deb --- /dev/null +++ b/testing/web-platform/tests/interfaces/service-workers.idl @@ -0,0 +1,240 @@ +// GENERATED CONTENT - DO NOT EDIT +// Content was automatically extracted by Reffy into webref +// (https://github.com/w3c/webref) +// Source: Service Workers Nightly (https://w3c.github.io/ServiceWorker/) + +[SecureContext, Exposed=(Window,Worker)] +interface ServiceWorker : EventTarget { + readonly attribute USVString scriptURL; + readonly attribute ServiceWorkerState state; + undefined postMessage(any message, sequence transfer); + undefined postMessage(any message, optional StructuredSerializeOptions options = {}); + + // event + attribute EventHandler onstatechange; +}; +ServiceWorker includes AbstractWorker; + +enum ServiceWorkerState { + "parsed", + "installing", + "installed", + "activating", + "activated", + "redundant" +}; + +[SecureContext, Exposed=(Window,Worker)] +interface ServiceWorkerRegistration : EventTarget { + readonly attribute ServiceWorker? installing; + readonly attribute ServiceWorker? waiting; + readonly attribute ServiceWorker? active; + [SameObject] readonly attribute NavigationPreloadManager navigationPreload; + + readonly attribute USVString scope; + readonly attribute ServiceWorkerUpdateViaCache updateViaCache; + + [NewObject] Promise update(); + [NewObject] Promise unregister(); + + // event + attribute EventHandler onupdatefound; +}; + +enum ServiceWorkerUpdateViaCache { + "imports", + "all", + "none" +}; + +partial interface Navigator { + [SecureContext, SameObject] readonly attribute ServiceWorkerContainer serviceWorker; +}; + +partial interface WorkerNavigator { + [SecureContext, SameObject] readonly attribute ServiceWorkerContainer serviceWorker; +}; + +[SecureContext, Exposed=(Window,Worker)] +interface ServiceWorkerContainer : EventTarget { + readonly attribute ServiceWorker? controller; + readonly attribute Promise ready; + + [NewObject] Promise register(USVString scriptURL, optional RegistrationOptions options = {}); + + [NewObject] Promise<(ServiceWorkerRegistration or undefined)> getRegistration(optional USVString clientURL = ""); + [NewObject] Promise> getRegistrations(); + + undefined startMessages(); + + // events + attribute EventHandler oncontrollerchange; + attribute EventHandler onmessage; // event.source of message events is ServiceWorker object + attribute EventHandler onmessageerror; +}; + +dictionary RegistrationOptions { + USVString scope; + WorkerType type = "classic"; + ServiceWorkerUpdateViaCache updateViaCache = "imports"; +}; + +[SecureContext, Exposed=(Window,Worker)] +interface NavigationPreloadManager { + Promise enable(); + Promise disable(); + Promise setHeaderValue(ByteString value); + Promise getState(); +}; + +dictionary NavigationPreloadState { + boolean enabled = false; + ByteString headerValue; +}; + +[Global=(Worker,ServiceWorker), Exposed=ServiceWorker] +interface ServiceWorkerGlobalScope : WorkerGlobalScope { + [SameObject] readonly attribute Clients clients; + [SameObject] readonly attribute ServiceWorkerRegistration registration; + [SameObject] readonly attribute ServiceWorker serviceWorker; + + [NewObject] Promise skipWaiting(); + + attribute EventHandler oninstall; + attribute EventHandler onactivate; + attribute EventHandler onfetch; + + attribute EventHandler onmessage; + attribute EventHandler onmessageerror; +}; + +[Exposed=ServiceWorker] +interface Client { + readonly attribute USVString url; + readonly attribute FrameType frameType; + readonly attribute DOMString id; + readonly attribute ClientType type; + undefined postMessage(any message, sequence transfer); + undefined postMessage(any message, optional StructuredSerializeOptions options = {}); +}; + +[Exposed=ServiceWorker] +interface WindowClient : Client { + readonly attribute DocumentVisibilityState visibilityState; + readonly attribute boolean focused; + [SameObject] readonly attribute FrozenArray ancestorOrigins; + [NewObject] Promise focus(); + [NewObject] Promise navigate(USVString url); +}; + +enum FrameType { + "auxiliary", + "top-level", + "nested", + "none" +}; + +[Exposed=ServiceWorker] +interface Clients { + // The objects returned will be new instances every time + [NewObject] Promise<(Client or undefined)> get(DOMString id); + [NewObject] Promise> matchAll(optional ClientQueryOptions options = {}); + [NewObject] Promise openWindow(USVString url); + [NewObject] Promise claim(); +}; + +dictionary ClientQueryOptions { + boolean includeUncontrolled = false; + ClientType type = "window"; +}; + +enum ClientType { + "window", + "worker", + "sharedworker", + "all" +}; + +[Exposed=ServiceWorker] +interface ExtendableEvent : Event { + constructor(DOMString type, optional ExtendableEventInit eventInitDict = {}); + undefined waitUntil(Promise f); +}; + +dictionary ExtendableEventInit : EventInit { + // Defined for the forward compatibility across the derived events +}; + +[Exposed=ServiceWorker] +interface FetchEvent : ExtendableEvent { + constructor(DOMString type, FetchEventInit eventInitDict); + [SameObject] readonly attribute Request request; + readonly attribute Promise preloadResponse; + readonly attribute DOMString clientId; + readonly attribute DOMString resultingClientId; + readonly attribute DOMString replacesClientId; + readonly attribute Promise handled; + + undefined respondWith(Promise r); +}; + +dictionary FetchEventInit : ExtendableEventInit { + required Request request; + Promise preloadResponse; + DOMString clientId = ""; + DOMString resultingClientId = ""; + DOMString replacesClientId = ""; + Promise handled; +}; + +[Exposed=ServiceWorker] +interface ExtendableMessageEvent : ExtendableEvent { + constructor(DOMString type, optional ExtendableMessageEventInit eventInitDict = {}); + readonly attribute any data; + readonly attribute USVString origin; + readonly attribute DOMString lastEventId; + [SameObject] readonly attribute (Client or ServiceWorker or MessagePort)? source; + readonly attribute FrozenArray ports; +}; + +dictionary ExtendableMessageEventInit : ExtendableEventInit { + any data = null; + USVString origin = ""; + DOMString lastEventId = ""; + (Client or ServiceWorker or MessagePort)? source = null; + sequence ports = []; +}; + +partial interface mixin WindowOrWorkerGlobalScope { + [SecureContext, SameObject] readonly attribute CacheStorage caches; +}; + +[SecureContext, Exposed=(Window,Worker)] +interface Cache { + [NewObject] Promise<(Response or undefined)> match(RequestInfo request, optional CacheQueryOptions options = {}); + [NewObject] Promise> matchAll(optional RequestInfo request, optional CacheQueryOptions options = {}); + [NewObject] Promise add(RequestInfo request); + [NewObject] Promise addAll(sequence requests); + [NewObject] Promise put(RequestInfo request, Response response); + [NewObject] Promise delete(RequestInfo request, optional CacheQueryOptions options = {}); + [NewObject] Promise> keys(optional RequestInfo request, optional CacheQueryOptions options = {}); +}; + +dictionary CacheQueryOptions { + boolean ignoreSearch = false; + boolean ignoreMethod = false; + boolean ignoreVary = false; +}; + +[SecureContext, Exposed=(Window,Worker)] +interface CacheStorage { + [NewObject] Promise<(Response or undefined)> match(RequestInfo request, optional MultiCacheQueryOptions options = {}); + [NewObject] Promise has(DOMString cacheName); + [NewObject] Promise open(DOMString cacheName); + [NewObject] Promise delete(DOMString cacheName); + [NewObject] Promise> keys(); +}; + +dictionary MultiCacheQueryOptions : CacheQueryOptions { + DOMString cacheName; +}; -- cgit v1.2.3