The lifetime of a service worker is tied to the execution lifetime of events and not references held by service worker clients to the ServiceWorker
object.
The lifetime of a service worker is tied to the execution lifetime of events and not references held by service worker clients to the {{ServiceWorker}} object.
A user agent may terminate service workers at any time it:
A user agent must persistently keep a list of registered service worker registrations unless otherwise they are explicitly unregistered. A user agent has a scope to registration map that stores the entries of the tuple of service worker registration's scope url and the corresponding service worker registration. The lifetime of service worker registrations is beyond that of the ServiceWorkerRegistration
objects which represent them within the lifetime of their corresponding service worker clients.
A user agent must persistently keep a list of registered service worker registrations unless otherwise they are explicitly unregistered. A user agent has a scope to registration map that stores the entries of the tuple of service worker registration's scope url and the corresponding service worker registration. The lifetime of service worker registrations is beyond that of the {{ServiceWorkerRegistration}} objects which represent them within the lifetime of their corresponding service worker clients.
[SecureContext, Exposed=(Window,Worker)] @@ -311,14 +311,14 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231 };-
A ServiceWorker
object represents a service worker. Each {{ServiceWorker}} object is associated with a service worker. Multiple separate objects implementing the {{ServiceWorker}} interface across documents and workers can all be associated with the same service worker simultaneously.
A {{ServiceWorker}} object represents a service worker. Each {{ServiceWorker}} object is associated with a service worker. Multiple separate objects implementing the {{ServiceWorker}} interface across documents and workers can all be associated with the same service worker simultaneously.
A {{ServiceWorker}} object has an associated {{ServiceWorkerState}} object which is itself associated with service worker's state.
The scriptURL
attribute must return the service worker's serialized script url.
The scriptURL
attribute must return the service worker's serialized script url.
For example, consider a document created by a navigation to https://example.com/app.html
which matches via the following registration call which has been previously executed:
The state
attribute must return the value (in ServiceWorkerState
enumeration) to which it was last set.
The state
attribute must return the value (in {{ServiceWorkerState}} enumeration) to which it was last set.
The postMessage(message, transfer)
method must run these steps:
The postMessage(message, transfer)
method must run these steps:
redundant
", throw an "{{InvalidStateError}}" exception and abort these steps. onstatechange
statechange
onstatechange
[SecureContext, Exposed=(Window,Worker)] @@ -411,12 +411,12 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231 };-
A ServiceWorkerRegistration
object represents a service worker registration. Each {{ServiceWorkerRegistration}} object is associated with a service worker registration (a service worker registration). Multiple separate objects implementing the {{ServiceWorkerRegistration}} interface across documents and workers can all be associated with the same service worker registration simultaneously.
A {{ServiceWorkerRegistration}} object represents a service worker registration. Each {{ServiceWorkerRegistration}} object is associated with a service worker registration (a service worker registration). Multiple separate objects implementing the {{ServiceWorkerRegistration}} interface across documents and workers can all be associated with the same service worker registration simultaneously.
installing
attribute must return the value to which it was last set.
installing
attribute must return the value to which it was last set.
The {{ServiceWorker}} objects returned from this attribute getter that represent the same service worker are the same objects.
waiting
attribute must return the value to which it was last set.
waiting
attribute must return the value to which it was last set.
The {{ServiceWorker}} objects returned from this attribute getter that represent the same service worker are the same objects.
active
attribute must return the value to which it was last set.
active
attribute must return the value to which it was last set.
The {{ServiceWorker}} objects returned from this attribute getter that represent the same service worker are the same objects.
The scope
attribute must return service worker registration's serialized scope url.
The scope
attribute must return service worker registration's serialized scope url.
In the example in section 3.1.1, the value of registration.scope
, obtained from navigator.serviceWorker.ready.then(function(registration) { console.log(registration.scope); })
for example, will be "https://example.com/
".
update()
method must run these steps:
update()
method must run these steps:
The {{ServiceWorkerRegistration/unregister()}} method unregisters the service worker registration. It is important to note that the currently controlled service worker client's active service worker's containing service worker registration is effective until all the service worker clients (including itself) using this service worker registration unload. That is, the {{ServiceWorkerRegistration/unregister()}} method only affects subsequent navigations.
-unregister()
method must run these steps:
unregister()
method must run these steps:
The following is the event handler (and its corresponding event handler event type) that must be supported, as event handler IDL attributes, by all objects implementing ServiceWorkerRegistration
interface:
The following is the event handler (and its corresponding event handler event type) that must be supported, as event handler IDL attributes, by all objects implementing {{ServiceWorkerRegistration}} interface:
onupdatefound |
+ onupdatefound |
updatefound |
oncontrollerchange |
+ oncontrollerchange |
controllerchange |
onmessage |
+ onmessage |
message |
The first time the context object's onmessage IDL attribute is set, its client message queue must be enabled.
+The first time the context object's {{ServiceWorkerContainer/onmessage}} IDL attribute is set, its client message queue must be enabled.
[Constructor(DOMString type, optional ServiceWorkerMessageEventInit eventInitDict), Exposed=(Window,Worker)] @@ -732,36 +732,36 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231 };-
Service workers define the message event that extends the {{Window/message}} event defined in [[!HTML]] to allow setting a {{ServiceWorker}} object as the source of the message. For the message event, service workers use the ServiceWorkerMessageEvent
interface.
Service workers define the message event that extends the {{Window/message}} event defined in [[!HTML]] to allow setting a {{ServiceWorker}} object as the source of the message. For the message event, service workers use the {{ServiceWorkerMessageEvent}} interface.
The data attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to null. It represents the message being sent.
+The data attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to null. It represents the message being sent.
The origin attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty string. It represents the origin of the service worker's environment settings object from which the message is sent.
+The origin attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty string. It represents the origin of the service worker's environment settings object from which the message is sent.
The lastEventId attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty string.
+The lastEventId attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty string.
The source attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to null. It represents the ServiceWorker
object whose associated service worker the message is sent from.
The source attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to null. It represents the {{ServiceWorker}} object whose associated service worker the message is sent from.
The ports attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty array. It represents the {{MessagePort}} array being sent.
+The ports attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty array. It represents the {{MessagePort}} array being sent.
statechange
statechange
updatefound
controllerchange
message
[Global=(Worker,ServiceWorker), Exposed=ServiceWorker] @@ -897,20 +897,20 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231 };-
A ServiceWorkerGlobalScope
object represents the global execution context of a service worker. A {{ServiceWorkerGlobalScope}} object has an associated service worker (a service worker).
A {{ServiceWorkerGlobalScope}} object represents the global execution context of a service worker. A {{ServiceWorkerGlobalScope}} object has an associated service worker (a service worker).
{{ServiceWorkerGlobalScope}} object provides generic, event-driven, time-limited script execution contexts that run at an origin. Once successfully registered, a service worker is started, kept alive and killed by their relationship to events, not service worker clients. Any type of synchronous requests must not be initiated inside of a service worker.
clients
attribute must return the {{Clients}} object that is associated with the context object.
clients
attribute must return the {{Clients}} object that is associated with the context object.
The registration
attribute must return the {{ServiceWorkerRegistration}} object that represents the service worker's containing service worker registration.
The registration
attribute must return the {{ServiceWorkerRegistration}} object that represents the service worker's containing service worker registration.
The {{ServiceWorkerGlobalScope/skipWaiting()}} method allows this service worker to progress from the registration's waiting position to active even while service worker clients are using the registration.
-skipWaiting()
method must run these steps:
skipWaiting()
method must run these steps:
The following are the event handlers (and their corresponding event handler event types) that must be supported, as event handler IDL attributes, by all objects implementing the ServiceWorkerGlobalScope interface:
+The following are the event handlers (and their corresponding event handler event types) that must be supported, as event handler IDL attributes, by all objects implementing the {{ServiceWorkerGlobalScope}} interface:
oninstall |
+ oninstall |
install |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
onactivate |
+ onactivate |
activate |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
onfetch |
+ onfetch |
fetch |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
onforeignfetch |
+ onforeignfetch |
foreignfetch |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
onmessage |
+ onmessage |
message |
install |
{{InstallEvent}} | -[Lifecycle event] The service worker's containing service worker registration's installing worker changes. (See step 11.2 of the Install algorithm.) | +[Lifecycle event] The service worker's containing service worker registration's installing worker changes. (See step 11.2 of the Install algorithm.) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
activate |
{{ExtendableEvent}} | -[Lifecycle event] The service worker's containing service worker registration's active worker changes. (See step 12.2 of the Activate algorithm.) | +[Lifecycle event] The service worker's containing service worker registration's active worker changes. (See step 12.2 of the Activate algorithm.) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
fetch |
{{FetchEvent}} | -[Functional event] The http fetch invokes Handle Fetch with request. As a result of performing Handle Fetch, the service worker returns a response to the http fetch. The response, represented by a {{Response}} object, can be retrieved from a {{Cache}} object or directly from network using {{WindowOrWorkerGlobalScope/fetch(input, init)|self.fetch(input, init)}} method. (A custom {{Response}} object can be another option.) | +[Functional event] The http fetch invokes Handle Fetch with request. As a result of performing Handle Fetch, the service worker returns a response to the http fetch. The response, represented by a {{Response}} object, can be retrieved from a {{Cache}} object or directly from network using {{WindowOrWorkerGlobalScope/fetch(input, init)|self.fetch(input, init)}} method. (A custom {{Response}} object can be another option.) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
foreignfetch |
@@ -2006,7 +2006,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
onstatechange
- | statechange
+ | onstatechange
+ | statechange
|
ServiceWorkerRegistration
ServiceWorkerRegistration
[SecureContext, Exposed=(Window,Worker)] -interface ServiceWorkerRegistration : EventTarget { - readonly attribute ServiceWorker? installing; - readonly attribute ServiceWorker? waiting; - readonly attribute ServiceWorker? active; +interface ServiceWorkerRegistration : EventTarget { + readonly attribute ServiceWorker? installing; + readonly attribute ServiceWorker? waiting; + readonly attribute ServiceWorker? active; - readonly attribute USVString scope; + readonly attribute USVString scope; - [NewObject] Promise<void> update(); - [NewObject] Promise<boolean> unregister(); + [NewObject] Promise<void> update(); + [NewObject] Promise<boolean> unregister(); // event - attribute EventHandler onupdatefound; + attribute EventHandler onupdatefound; };-
A ServiceWorkerRegistration
object represents a service worker registration. Each ServiceWorkerRegistration
object is associated with a service worker registration (a service worker registration). Multiple separate objects implementing the ServiceWorkerRegistration
interface across documents and workers can all be associated with the same service worker registration simultaneously.
A ServiceWorkerRegistration
object represents a service worker registration. Each ServiceWorkerRegistration
object is associated with a service worker registration (a service worker registration). Multiple separate objects implementing the ServiceWorkerRegistration
interface across documents and workers can all be associated with the same service worker registration simultaneously.
installing
installing
attribute must return the value to which it was last set.
The ServiceWorker
objects returned from this attribute getter that represent the same service worker are the same objects.
installing
installing
attribute must return the value to which it was last set.
The ServiceWorker
objects returned from this attribute getter that represent the same service worker are the same objects.
waiting
waiting
attribute must return the value to which it was last set.
The ServiceWorker
objects returned from this attribute getter that represent the same service worker are the same objects.
waiting
waiting
attribute must return the value to which it was last set.
The ServiceWorker
objects returned from this attribute getter that represent the same service worker are the same objects.
active
active
attribute must return the value to which it was last set.
The ServiceWorker
objects returned from this attribute getter that represent the same service worker are the same objects.
active
active
attribute must return the value to which it was last set.
The ServiceWorker
objects returned from this attribute getter that represent the same service worker are the same objects.
scope
The scope
attribute must return service worker registration’s serialized scope url.
scope
The scope
attribute must return service worker registration’s serialized scope url.
In the example in section 3.1.1, the value of registration.scope
, obtained from navigator.serviceWorker.ready.then(function(registration) { console.log(registration.scope); })
for example, will be "https://example.com/
".
update()
update()
method must run these steps:
update()
update()
method must run these steps:
InvalidStateError
" exception and abort these steps.
- ServiceWorkerGlobalScope
object, and globalObject’s associated service worker’s state is installing, reject p with an "InvalidStateError
" exception and abort these steps.
+ ServiceWorkerGlobalScope
object, and globalObject’s associated service worker’s state is installing, reject p with an "InvalidStateError
" exception and abort these steps.
unregister()
The unregister()
method unregisters the service worker registration. It is important to note that the currently controlled service worker client’s active service worker’s containing service worker registration is effective until all the service worker clients (including itself) using this service worker registration unload. That is, the unregister()
method only affects subsequent navigations.
unregister()
method must run these steps:
unregister()
The unregister()
method unregisters the service worker registration. It is important to note that the currently controlled service worker client’s active service worker’s containing service worker registration is effective until all the service worker clients (including itself) using this service worker registration unload. That is, the unregister()
method only affects subsequent navigations.
unregister()
method must run these steps:
The following is the event handler (and its corresponding event handler event type) that must be supported, as event handler IDL attributes, by all objects implementing ServiceWorkerRegistration
interface:
The following is the event handler (and its corresponding event handler event type) that must be supported, as event handler IDL attributes, by all objects implementing ServiceWorkerRegistration
interface:
onupdatefound
+ | onupdatefound
| updatefound
|
navigator.serviceWorker
navigator.serviceWorker
partial interface Navigator { - [SecureContext, SameObject] readonly attribute ServiceWorkerContainer serviceWorker; + [SecureContext, SameObject] readonly attribute ServiceWorkerContainer serviceWorker; }; partial interface WorkerNavigator { - [SecureContext, SameObject] readonly attribute ServiceWorkerContainer serviceWorker; + [SecureContext, SameObject] readonly attribute ServiceWorkerContainer serviceWorker; };-
The serviceWorker
attribute must return the ServiceWorkerContainer
object that is associated with the context object.
The serviceWorker
attribute must return the ServiceWorkerContainer
object that is associated with the context object.
ServiceWorkerContainer
ServiceWorkerContainer
[SecureContext, Exposed=(Window,Worker)] -interface ServiceWorkerContainer : EventTarget { - readonly attribute ServiceWorker? controller; - [SameObject] readonly attribute Promise<ServiceWorkerRegistration> ready; +interface ServiceWorkerContainer : EventTarget { + readonly attribute ServiceWorker? controller; + [SameObject] readonly attribute Promise<ServiceWorkerRegistration> ready; - [NewObject] Promise<ServiceWorkerRegistration> register(USVString scriptURL, optional RegistrationOptions options); + [NewObject] Promise<ServiceWorkerRegistration> register(USVString scriptURL, optional RegistrationOptions options); - [NewObject] Promise<any> getRegistration(optional USVString clientURL = ""); - [NewObject] Promise<sequence<ServiceWorkerRegistration>> getRegistrations(); + [NewObject] Promise<any> getRegistration(optional USVString clientURL = ""); + [NewObject] Promise<sequence<ServiceWorkerRegistration>> getRegistrations(); - void startMessages(); + void startMessages(); // events - attribute EventHandler oncontrollerchange; - attribute EventHandler onmessage; // event.source of message events is ServiceWorker object + attribute EventHandler oncontrollerchange; + attribute EventHandler onmessage; // event.source of message events is ServiceWorker object };-
dictionary RegistrationOptions { +dictionary RegistrationOptions { USVString scope; WorkerType type = "classic"; };-The user agent must create a
-ServiceWorkerContainer
object when aNavigator
object or aWorkerNavigator
object is created and associate it with that object.A
-ServiceWorkerContainer
provides capabilities to register, unregister, and update the service worker registrations, and provides access to the state of the service worker registrations and their associated service workers.A
-ServiceWorkerContainer
has an associated service worker client, which is a service worker client whose global object is associated with theNavigator
object or theWorkerNavigator
object that theServiceWorkerContainer
is retrieved from.A
-ServiceWorkerContainer
object has an associated ready promise (a promise). It is initially set to a new promise.A
+ServiceWorkerContainer
object has a task source called the client message queue, initially empty. A client message queue can be enabled or disabled, and is initially disabled. When aServiceWorkerContainer
object’s client message queue is enabled, the event loop must use it as one of its task sources. When theServiceWorkerContainer
object’s relevant global object is aWindow
object, all tasks queued on its client message queue must be associated with its relevant settings object’s responsible document.The user agent must create a
+ServiceWorkerContainer
object when aNavigator
object or aWorkerNavigator
object is created and associate it with that object.A
+ServiceWorkerContainer
provides capabilities to register, unregister, and update the service worker registrations, and provides access to the state of the service worker registrations and their associated service workers.A
+ServiceWorkerContainer
has an associated service worker client, which is a service worker client whose global object is associated with theNavigator
object or theWorkerNavigator
object that theServiceWorkerContainer
is retrieved from.A
+ServiceWorkerContainer
object has an associated ready promise (a promise). It is initially set to a new promise.A
ServiceWorkerContainer
object has a task source called the client message queue, initially empty. A client message queue can be enabled or disabled, and is initially disabled. When aServiceWorkerContainer
object’s client message queue is enabled, the event loop must use it as one of its task sources. When theServiceWorkerContainer
object’s relevant global object is aWindow
object, all tasks queued on its client message queue must be associated with its relevant settings object’s responsible document.- 3.4.1.
-controller
+
controller
attribute must run these steps:3.4.1.
+controller
controller
attribute must run these steps:-
-- Let client be the context object’s service worker client. -
- Return the
ServiceWorker
object that represents client’s active service worker. +- Let client be the context object’s service worker client. +
- Return the
ServiceWorker
object that represents client’s active service worker.+
navigator.serviceWorker.controller
returnsnull
if the request is a force refresh (shift+refresh). TheServiceWorker
objects returned from this attribute getter that represent the same service worker are the same objects.
navigator.serviceWorker.controller
returnsnull
if the request is a force refresh (shift+refresh). TheServiceWorker
objects returned from this attribute getter that represent the same service worker are the same objects.- 3.4.2.
-ready
+
ready
attribute must run these steps:3.4.2.
+ready
ready
attribute must run these steps:-
-- If the context object’s ready promise is settled, return the context object’s ready promise. -
- Let client be the context object’s service worker client. +
- If the context object’s ready promise is settled, return the context object’s ready promise. +
- Let client be the context object’s service worker client.
- Let registration be null.
- Let clientURL be client’s creation URL.
- @@ -2084,19 +2084,19 @@
active worker is null, wait until registration’s active worker changes.
Implementers should consider this condition is met when the corresponding registration request gets to the step 6 of Activate algorithm.
-- Resolve context object’s ready promise with the
ServiceWorkerRegistration
object which represents registration. +- Resolve context object’s ready promise with the
ServiceWorkerRegistration
object which represents registration.- Return context object’s ready promise. +
- Return context object’s ready promise. -
When the
+ready
attribute is accessed, the returned promise will never reject. Instead, it waits until the promise resolves with a service worker registration that has an active worker.When the
ready
attribute is accessed, the returned promise will never reject. Instead, it waits until the promise resolves with a service worker registration that has an active worker.- 3.4.3.
-register(scriptURL, options)
The
-register(scriptURL, options)
method creates or updates a service worker registration for the given scope url. If successful, a service worker registration ties the provided scriptURL to a scope url, which is subsequently used for navigation matching.+
register(scriptURL, options)
method must run these steps:3.4.3.
+register(scriptURL, options)
The
+register(scriptURL, options)
method creates or updates a service worker registration for the given scope url. If successful, a service worker registration ties the provided scriptURL to a scope url, which is subsequently used for navigation matching.
register(scriptURL, options)
method must run these steps:
- Let p be a promise. -
- Let client be the context object’s service worker client. +
- Let client be the context object’s service worker client.
- Let scriptURL be the result of parsing scriptURL with the context object’s relevant settings object’s API base URL.
- Let scopeURL be null.
- If options.
scope
is present, set scopeURL to the result of parsing options.scope
with the context object’s relevant settings object’s API base URL. @@ -2105,10 +2105,10 @@-
3.4.4.
-getRegistration(clientURL)
+
getRegistration(clientURL)
method must run these steps:3.4.4.
+getRegistration(clientURL)
getRegistration(clientURL)
method must run these steps:-
- Let client be the context object’s service worker client. +
- Let client be the context object’s service worker client.
- Let clientURL be the result of parsing clientURL with the context object’s relevant settings object’s API base URL.
- If clientURL is failure, return a promise rejected with a
TypeError
.- If the origin of clientURL is not client’s origin, return a promise rejected with a "
SecurityError
" exception. @@ -2120,7 +2120,7 @@ServiceWorkerRegistration object which represents registration. +
- Resolve promise with the
ServiceWorkerRegistration
object which represents registration.- Else: @@ -2132,10 +2132,10 @@
-
3.4.5.
-getRegistrations()
+
getRegistrations()
method must run these steps:3.4.5.
+getRegistrations()
getRegistrations()
method must run these steps:-
@@ -2152,12 +2152,12 @@- Let client be the context object’s service worker client. +
- Let client be the context object’s service worker client.
- Let promise be a new promise.
- Run the following substeps in parallel: @@ -2144,7 +2144,7 @@
Record {[[key]], [[value]]} entry of scope to registration map:
-
- If the origin of the result of parsing entry.[[key]] is the same as client’s origin, and entry.[[value]]'s uninstalling flag is unset, add the
ServiceWorkerRegistration
object associated with entry.[[value]] to the array. +- If the origin of the result of parsing entry.[[key]] is the same as client’s origin, and entry.[[value]]'s uninstalling flag is unset, add the
ServiceWorkerRegistration
object associated with entry.[[value]] to the array.- Resolve promise with array.
-
3.4.6.
-startMessages()
+
startMessages()
method must enable the context object’s client message queue if it is not enabled.3.4.6.
+startMessages()
startMessages()
method must enable the context object’s client message queue if it is not enabled.3.4.7. Event handlers
-The following are the event handlers (and their corresponding event handler event types) that must be supported, as event handler IDL attributes, by all objects implementing the ServiceWorkerContainer interface:
+The following are the event handlers (and their corresponding event handler event types) that must be supported, as event handler IDL attributes, by all objects implementing the
ServiceWorkerContainer
interface:-
@@ -2165,59 +2165,59 @@ event handler event type
- oncontrollerchange
+oncontrollerchange
controllerchange
- onmessage
+onmessage
message
The first time the context object’s onmessage IDL attribute is set, its client message queue must be enabled.
+The first time the context object’s
onmessage
IDL attribute is set, its client message queue must be enabled.
ServiceWorkerMessageEvent
[Constructor(DOMString type, optional ServiceWorkerMessageEventInit eventInitDict), Exposed=(Window,Worker)] -interface ServiceWorkerMessageEvent : Event { - readonly attribute any data; - readonly attribute USVString origin; - readonly attribute DOMString lastEventId; - [SameObject] readonly attribute (ServiceWorker or MessagePort)? source; - readonly attribute FrozenArray<MessagePort> ports; +3.5.
+ServiceWorkerMessageEvent
[Constructor(DOMString type, optional ServiceWorkerMessageEventInit eventInitDict), Exposed=(Window,Worker)] +interface ServiceWorkerMessageEvent : Event { + readonly attribute any data; + readonly attribute USVString origin; + readonly attribute DOMString lastEventId; + [SameObject] readonly attribute (ServiceWorker or MessagePort)? source; + readonly attribute FrozenArray<MessagePort> ports; };-dictionary ServiceWorkerMessageEventInit : EventInit { +dictionary ServiceWorkerMessageEventInit : EventInit { any data = null; USVString origin = ""; DOMString lastEventId = ""; - (ServiceWorker or MessagePort)? source = null; + (ServiceWorker or MessagePort)? source = null; sequence<MessagePort> ports = []; };-Service workers define the message event that extends the
+message
event defined in [HTML] to allow setting aServiceWorker
object as the source of the message. For the message event, service workers use theServiceWorkerMessageEvent
interface.Service workers define the message event that extends the
message
event defined in [HTML] to allow setting aServiceWorker
object as the source of the message. For the message event, service workers use theServiceWorkerMessageEvent
interface.- 3.5.1.
-event.data
The data attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to null. It represents the message being sent.
+3.5.1.
+event.data
The data attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to null. It represents the message being sent.
- 3.5.2.
-event.origin
The origin attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty string. It represents the origin of the service worker’s environment settings object from which the message is sent.
+3.5.2.
+event.origin
The origin attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty string. It represents the origin of the service worker’s environment settings object from which the message is sent.
- 3.5.3.
-event.lastEventId
The lastEventId attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty string.
+3.5.3.
+event.lastEventId
The lastEventId attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty string.
- 3.5.4.
-event.source
The source attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to null. It represents the
+ServiceWorker
object whose associated service worker the message is sent from.3.5.4.
+event.source
The source attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to null. It represents the
ServiceWorker
object whose associated service worker the message is sent from.- 3.5.5.
-event.ports
The ports attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty array. It represents the
+MessagePort
array being sent.3.5.5.
+event.ports
The ports attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty array. It represents the
MessagePort
array being sent.
The following event is dispatched on ServiceWorker
object:
The following event is dispatched on ServiceWorker
object:
statechange
+ | statechange
| Event
- | The state attribute of the ServiceWorker object is changed.
+ | The state attribute of the ServiceWorker object is changed.
|
The following event is dispatched on ServiceWorkerRegistration
object:
The following event is dispatched on ServiceWorkerRegistration
object:
updatefound
| Event
- | The service worker registration’s installing worker changes. (See step 8 of the Install algorithm.) + | The service worker registration’s installing worker changes. (See step 8 of the Install algorithm.) |
The following events are dispatched on ServiceWorkerContainer
object:
The following events are dispatched on ServiceWorkerContainer
object:
controllerchange
| Event
- | The service worker client’s active service worker changes. (See step 9.2 of the Activate algorithm. The skip waiting flag of a service worker causes activation of the service worker registration to occur while service worker clients are using the service worker registration, navigator.serviceWorker.controller immediately reflects the active worker as the service worker that controls the service worker client.)
+ | The service worker client’s active service worker changes. (See step 9.2 of the Activate algorithm. The skip waiting flag of a service worker causes activation of the service worker registration to occur while service worker clients are using the service worker registration, navigator.serviceWorker.controller immediately reflects the active worker as the service worker that controls the service worker client.)
| ||||
message
- | ServiceWorkerMessageEvent
+ | ServiceWorkerMessageEvent
| When it receives a message. |
ServiceWorkerGlobalScope
-[Global=(Worker,ServiceWorker), Exposed=ServiceWorker] -interface ServiceWorkerGlobalScope : WorkerGlobalScope { +4.1.
+ServiceWorkerGlobalScope
[Global=(Worker,ServiceWorker), Exposed=ServiceWorker] +interface ServiceWorkerGlobalScope : WorkerGlobalScope { // A container for a list of Client objects that correspond to // browsing contexts (or shared workers) that are on the origin of this SW - [SameObject] readonly attribute Clients clients; - [SameObject] readonly attribute ServiceWorkerRegistration registration; + [SameObject] readonly attribute Clients clients; + [SameObject] readonly attribute ServiceWorkerRegistration registration; - [NewObject] Promise<void> skipWaiting(); + [NewObject] Promise<void> skipWaiting(); - attribute EventHandler oninstall; - attribute EventHandler onactivate; - attribute EventHandler onfetch; + attribute EventHandler oninstall; + attribute EventHandler onactivate; + attribute EventHandler onfetch; attribute EventHandler onforeignfetch; // event - attribute EventHandler onmessage; // event.source of the message events is Client object + attribute EventHandler onmessage; // event.source of the message events is Client object };-A
-ServiceWorkerGlobalScope
object represents the global execution context of a service worker. AServiceWorkerGlobalScope
object has an associated service worker (a service worker).+
ServiceWorkerGlobalScope
object provides generic, event-driven, time-limited script execution contexts that run at an origin. Once successfully registered, a service worker is started, kept alive and killed by their relationship to events, not service worker clients. Any type of synchronous requests must not be initiated inside of a service worker.A
+ServiceWorkerGlobalScope
object represents the global execution context of a service worker. AServiceWorkerGlobalScope
object has an associated service worker (a service worker).
ServiceWorkerGlobalScope
object provides generic, event-driven, time-limited script execution contexts that run at an origin. Once successfully registered, a service worker is started, kept alive and killed by their relationship to events, not service worker clients. Any type of synchronous requests must not be initiated inside of a service worker.- 4.1.1.
-clients
+
clients
attribute must return theClients
object that is associated with the context object.4.1.1.
+clients
clients
attribute must return theClients
object that is associated with the context object.- 4.1.2.
-registration
The
+registration
attribute must return theServiceWorkerRegistration
object that represents the service worker’s containing service worker registration.4.1.2.
+registration
The
registration
attribute must return theServiceWorkerRegistration
object that represents the service worker’s containing service worker registration.- 4.1.3.
-skipWaiting()
The
-skipWaiting()
method allows this service worker to progress from the registration’s waiting position to active even while service worker clients are using the registration.+
skipWaiting()
method must run these steps:4.1.3.
+skipWaiting()
The
+skipWaiting()
method allows this service worker to progress from the registration’s waiting position to active even while service worker clients are using the registration.
skipWaiting()
method must run these steps:
- Let promise be a new promise.
- @@ -2352,7 +2352,7 @@
4.1.4. Event handlers
-The following are the event handlers (and their corresponding event handler event types) that must be supported, as event handler IDL attributes, by all objects implementing the ServiceWorkerGlobalScope interface:
+The following are the event handlers (and their corresponding event handler event types) that must be supported, as event handler IDL attributes, by all objects implementing the
ServiceWorkerGlobalScope
interface:
@@ -2360,65 +2360,65 @@ event handler event type
- oninstall
+oninstall
install
- onactivate
+onactivate
activate
- onfetch
+onfetch
fetch
onforeignfetch
foreignfetch
- onmessage
+onmessage
message
- 4.2.
+Client
4.2.
Client
[Exposed=ServiceWorker] -interface Client { - readonly attribute USVString url; - readonly attribute DOMString id; - readonly attribute boolean reserved; - void postMessage(any message, optional sequence<object> transfer = []); +interface Client { + readonly attribute USVString url; + readonly attribute DOMString id; + readonly attribute boolean reserved; + void postMessage(any message, optional sequence<object> transfer = []); }; [Exposed=ServiceWorker] -interface WindowClient : Client { - readonly attribute VisibilityState visibilityState; - readonly attribute boolean focused; - [SameObject] readonly attribute FrozenArray<USVString> ancestorOrigins; - [NewObject] Promise<WindowClient> focus(); - [NewObject] Promise<WindowClient> navigate(USVString url); +interface WindowClient : Client { + readonly attribute VisibilityState visibilityState; + readonly attribute boolean focused; + [SameObject] readonly attribute FrozenArray<USVString> ancestorOrigins; + [NewObject] Promise<WindowClient> focus(); + [NewObject] Promise<WindowClient> navigate(USVString url); };-A
-Client
object has an associated service worker client (a service worker client).A
-WindowClient
object has an associated visibility state, which is one ofvisibilityState
attribute value.A
-WindowClient
object has an associated focus state, which is either true or false (initially false).A
+WindowClient
object has an associated ancestor origins array.A
+Client
object has an associated service worker client (a service worker client).A
+WindowClient
object has an associated visibility state, which is one ofvisibilityState
attribute value.A
+WindowClient
object has an associated focus state, which is either true or false (initially false).A
WindowClient
object has an associated ancestor origins array.- 4.2.1.
-url
The
+url
attribute must return the context object’s associated service worker client’s serialized creation URL.4.2.1.
+url
The
url
attribute must return the context object’s associated service worker client’s serialized creation URL.- 4.2.2.
-id
The
+id
attribute must return its associated service worker client’s id.4.2.2.
+id
The
id
attribute must return its associated service worker client’s id.- 4.2.3.
-reserved
The
+reserved
attribute must return true if the context object’s associated service worker client’s execution ready flag is unset, and false otherwise.4.2.3.
+reserved
The
reserved
attribute must return true if the context object’s associated service worker client’s execution ready flag is unset, and false otherwise.Defining the execution ready flag is a work in progress. See the pull request to HTML.
- 4.2.4.
-postMessage(message, transfer)
The
+postMessage(message, transfer)
method must run these steps:4.2.4.
+postMessage(message, transfer)
The
postMessage(message, transfer)
method must run these steps:
- Let sourceSettings be the context object’s relevant settings object. -
- Let destination be the
ServiceWorkerContainer
object whose service worker client is the context object’s service worker client. +- Let destination be the
ServiceWorkerContainer
object whose service worker client is the context object’s service worker client.- If destination is null, throw an "
InvalidStateError
" exception.- Let targetRealm be destination’s relevant Realm.
- Let cloneRecord be StructuredCloneWithTransfer(message, transfer, targetRealm). If this throws an exception, rethrow that exception and abort these steps. @@ -2427,42 +2427,42 @@
Add a task that runs the following steps to destination’s client message queue:
-
- Create an event e that uses the
ServiceWorkerMessageEvent
interface, with the event type message, which does not bubble and is not cancelable. -- Let the
data
attribute of e be initialized to clonedMessage. -- Let the
origin
attribute of e be initialized to the Unicode serialization of sourceSettings’s origin. -- Let the
source
attribute of e be initialized to aServiceWorker
object, which represents the service worker associated with sourceSettings’s global object. -- Let the
ports
attribute of e be initialized to newPorts. +- Create an event e that uses the
ServiceWorkerMessageEvent
interface, with the event type message, which does not bubble and is not cancelable. +- Let the
data
attribute of e be initialized to clonedMessage. +- Let the
origin
attribute of e be initialized to the Unicode serialization of sourceSettings’s origin. +- Let the
source
attribute of e be initialized to aServiceWorker
object, which represents the service worker associated with sourceSettings’s global object. +- Let the
ports
attribute of e be initialized to newPorts.- Dispatch e at destination.
- 4.2.5.
-visibilityState
The
+visibilityState
attribute must return the context object’s visibility state.4.2.5.
+visibilityState
The
visibilityState
attribute must return the context object’s visibility state.- 4.2.6.
-focused
The
+focused
attribute must return the context object’s focus state.4.2.6.
+focused
The
focused
attribute must return the context object’s focus state.- 4.2.7.
-ancestorOrigins
The
+ancestorOrigins
attribute must return the context object’s associated service worker client’s ancestor origins array.4.2.7.
+ancestorOrigins
The
ancestorOrigins
attribute must return the context object’s associated service worker client’s ancestor origins array.- 4.2.8.
-focus()
The
+focus()
method must run these steps:4.2.8.
+focus()
The
focus()
method must run these steps:
- If this algorithm is not triggered by user activation, return a promise rejected with an "
InvalidAccessError
" exception.- Let promise be a new promise.
- Run these substeps in parallel:
-
@@ -2478,25 +2478,25 @@- Let browsingContext be the context object’s associated service worker client’s global object’s browsing context. +
- Let browsingContext be the context object’s associated service worker client’s global object’s browsing context.
- Let visibilityState be null.
- Let focusState be false.
- Let ancestorOrigins be the empty array.
- - Queue a task task to run the following substeps on the context object’s associated service worker client’s responsible event loop using the user interaction task source: + Queue a task task to run the following substeps on the context object’s associated service worker client’s responsible event loop using the user interaction task source:
- Run the focusing steps with browsingContext.
- Set visibilityState to browsingContext’s active document’s
visibilityState
attribute value. @@ -2470,7 +2470,7 @@active document’s relevant global object’s
Location
object’s ancestor origins array.- Wait for task to have executed. -
- Let windowClient be the result of running Create Window Client algorithm with the context object’s associated service worker client, visibilityState, focusState, and ancestorOrigins as the arguments. +
- Let windowClient be the result of running Create Window Client algorithm with the context object’s associated service worker client, visibilityState, focusState, and ancestorOrigins as the arguments.
- If windowClient’s focus state is true, resolve promise with windowClient.
- Else, reject promise with a
TypeError
.-
4.2.9.
-navigate(url)
The
+navigate()
method must run these steps:4.2.9.
+navigate(url)
The
navigate()
method must run these steps:
- Let url be the result of parsing url with the context object’s relevant settings object’s API base URL.
- If url is failure, return a promise rejected with a
TypeError
.- If url is
about:blank
, return a promise rejected with aTypeError
. -- If the context object’s associated service worker client’s active service worker is not the context object’s relevant global object’s service worker, return a promise rejected with a
TypeError
. +- If the context object’s associated service worker client’s active service worker is not the context object’s relevant global object’s service worker, return a promise rejected with a
TypeError
.- Let promise be a new promise.
- Run these substeps in parallel:
-
- Let browsingContext be the context object’s associated service worker client’s global object’s browsing context. +
- Let browsingContext be the context object’s associated service worker client’s global object’s browsing context.
- If browsingContext has discarded its
Document
, reject promise with aTypeError
and abort these steps.- Let navigateFailed to false.
- Let visibilityState be null.
- Let focusState be false.
- Let ancestorOrigins be the empty array.
- - Queue a task task to run the following substeps on the context object’s associated service worker client’s responsible event loop using the user interaction task source: + Queue a task task to run the following substeps on the context object’s associated service worker client’s responsible event loop using the user interaction task source:
- HandleNavigate: Navigate browsingContext to url with exceptions enabled. The source browsing context must be browsingContext.
- If the algorithm steps invoked in the step labeled HandleNavigate throws an exception, set navigateFailed to true. @@ -2507,7 +2507,7 @@
Wait for task to have executed (including its asynchronous steps).
- If navigateFailed is true, reject promise with a
TypeError
and abort these steps.- - If browsingContext’s
Window
object’s environment settings object’s creation URL’s origin is not the same as the service worker’s origin, then: + If browsingContext’sWindow
object’s environment settings object’s creation URL’s origin is not the same as the service worker’s origin, then:
- Resolve promise with null.
- Abort these steps. @@ -2520,40 +2520,40 @@
- 4.3.
+Clients
4.3.
Clients
[Exposed=ServiceWorker] -interface Clients { +interface Clients { // The objects returned will be new instances every time - [NewObject] Promise<any> get(DOMString id); - [NewObject] Promise<sequence<Client>> matchAll(optional ClientQueryOptions options); - [NewObject] Promise<WindowClient?> openWindow(USVString url); - [NewObject] Promise<void> claim(); + [NewObject] Promise<any> get(DOMString id); + [NewObject] Promise<sequence<Client>> matchAll(optional ClientQueryOptions options); + [NewObject] Promise<WindowClient?> openWindow(USVString url); + [NewObject] Promise<void> claim(); };-dictionary ClientQueryOptions { +dictionary ClientQueryOptions { boolean includeUncontrolled = false; boolean includeReserved = false; - ClientType type = "window"; + ClientType type = "window"; };-enum ClientType { +enum ClientType { "window", "worker", "sharedworker", "all" };-The user agent must create a
+Clients
object when aServiceWorkerGlobalScope
object is created and associate it with that object.The user agent must create a
Clients
object when aServiceWorkerGlobalScope
object is created and associate it with that object.- 4.3.1.
-get(id)
The
+get(id)
method must run these steps:4.3.1.
+get(id)
The
get(id)
method must run these steps:
- Let promise be a new promise.
- Run these substeps in parallel:
- - For each service worker client client whose origin is the same as the associated service worker’s origin: + For each service worker client client whose origin is the same as the associated service worker’s origin:
- If client’s id is not id, continue to the next iteration of the loop.
- @@ -2599,8 +2599,8 @@
-
4.3.2.
-matchAll(options)
The
+matchAll(options)
method must run these steps:4.3.2.
+matchAll(options)
The
matchAll(options)
method must run these steps:
- Let promise be a new promise.
- @@ -2608,7 +2608,7 @@
service worker client client whose origin is the same as the associated service worker’s origin: + For each service worker client client whose origin is the same as the associated service worker’s origin:
- If client is a type of environment, then: @@ -2623,7 +2623,7 @@
- -4.3.4.
-claim()
The
+claim()
method must run these steps:4.3.4.
+claim()
The
claim()
method must run these steps:-
- If the service worker is not an active worker, return a promise rejected with an "
InvalidStateError
" exception. +- If the service worker is not an active worker, return a promise rejected with an "
InvalidStateError
" exception.- Let promise be a new promise.
- Run the following substeps in parallel:
@@ -2756,38 +2756,38 @@
- - For each service worker client client whose origin is the same as the service worker’s origin: + For each service worker client client whose origin is the same as the service worker’s origin:
- If client is a type of environment, then: @@ -2740,12 +2740,12 @@
secure context, continue to the next iteration of the loop.
- Let registration be the result of running Match Service Worker Registration algorithm passing client’s creation URL as the argument. -
- If registration is not the service worker’s containing service worker registration, continue to the next iteration of the loop. +
- If registration is not the service worker’s containing service worker registration, continue to the next iteration of the loop.
- - If client’s active service worker is not the service worker, then: + If client’s active service worker is not the service worker, then:
- Invoke Handle Service Worker Client Unload with client as the argument. -
- Set client’s active service worker to service worker. +
- Set client’s active service worker to service worker.
- Invoke Notify Controller Change algorithm with client as the argument.
4.4.
ExtendableEvent
+4.4.
ExtendableEvent
[Constructor(DOMString type, optional ExtendableEventInit eventInitDict), Exposed=ServiceWorker] -interface ExtendableEvent : Event { - void waitUntil(Promise<any> f); +interface ExtendableEvent : Event { + void waitUntil(Promise<any> f); };dictionary ExtendableEventInit : EventInit { // Defined for the forward compatibility across the derived events };-An
-ExtendableEvent
object has an associated extend lifetime promises (an array of promises). It is initially an empty array.An
-ExtendableEvent
object has an associated extensions allowed flag. It is initially set.Service workers have two lifecycle events,
-install
andactivate
. Service workers use theExtendableEvent
interface foractivate
event andinstall
event.Service worker extensions that define event handlers may also use or extend the
-ExtendableEvent
interface.When dispatching an event e that uses the
+ExtendableEvent
interface, the user agent must run these steps:An
+ExtendableEvent
object has an associated extend lifetime promises (an array of promises). It is initially an empty array.An
+ExtendableEvent
object has an associated extensions allowed flag. It is initially set.Service workers have two lifecycle events,
+install
andactivate
. Service workers use theExtendableEvent
interface foractivate
event andinstall
event.Service worker extensions that define event handlers may also use or extend the
+ExtendableEvent
interface.When dispatching an event e that uses the
ExtendableEvent
interface, the user agent must run these steps:-
- If e’s extend lifetime promises is empty, unset e’s extensions allowed flag and abort these steps. +
- If e’s extend lifetime promises is empty, unset e’s extensions allowed flag and abort these steps.
- Let extendLifetimePromises be an empty array.
- Run the following substeps in parallel:
-
- SetupPromiseArray: Set extendLifetimePromises to a copy of e’s extend lifetime promises. +
- SetupPromiseArray: Set extendLifetimePromises to a copy of e’s extend lifetime promises.
- Wait until all the promises in extendLifetimePromises settle. -
- If the length of extendLifetimePromises does not equal the length of e’s extend lifetime promises, jump to the step labeled SetupPromiseArray. +
- If the length of extendLifetimePromises does not equal the length of e’s extend lifetime promises, jump to the step labeled SetupPromiseArray.
- Unset e’s extensions allowed flag.
The user agent should not terminate the service worker associated with e’s relevant settings object’s global object until e’s extensions allowed flag is unset. However, the user agent may impose a time limit to this lifetime extension.
- 4.4.1.
-event.waitUntil(f)
-
waitUntil(f)
method extends the lifetime of the event.+
waitUntil(f)
method must run these steps:4.4.1.
+event.waitUntil(f)
+
waitUntil(f)
method extends the lifetime of the event.
waitUntil(f)
method must run these steps:-
- If the extensions allowed flag is unset, then: @@ -2795,24 +2795,24 @@
Throw an "
InvalidStateError
" exception.- Abort these steps.
- Add f to the extend lifetime promises. +
- Add f to the extend lifetime promises.
Service workers and extensions that define event handlers may define their own behaviors, allowing the extend lifetime promises to suggest operation length, and the rejected state of any of the promise in extend lifetime promises to suggest operation failure.
+Service workers and extensions that define event handlers may define their own behaviors, allowing the extend lifetime promises to suggest operation length, and the rejected state of any of the promise in extend lifetime promises to suggest operation failure.
Service workers define the following behaviors for
install
event andactivate
event, respectively:-
- Adding a promise f to the event’s extend lifetime promises delays treating the installing worker as installed (i.e. a waiting worker) until all the promises in the extend lifetime promises resolve successfully. (See step 11.3.1 of Install algorithm.) If f rejects, the installation fails. This is primarily used to ensure that a service worker is not considered installed (i.e. a waiting worker) until all of the core caches it depends on are populated. -
- Adding a promise to the event’s extend lifetime promises delays treating the active worker as activated until all the promises in the extend lifetime promises settle. (See step 12.3 of Activate algorithm.) This is primarily used to ensure that any functional events are not dispatched to the
ServiceWorkerGlobalScope
object that represents the service worker until it upgrades database schemas and deletes the outdated cache entries. +- Adding a promise f to the event’s extend lifetime promises delays treating the installing worker as installed (i.e. a waiting worker) until all the promises in the extend lifetime promises resolve successfully. (See step 11.3.1 of Install algorithm.) If f rejects, the installation fails. This is primarily used to ensure that a service worker is not considered installed (i.e. a waiting worker) until all of the core caches it depends on are populated. +
- Adding a promise to the event’s extend lifetime promises delays treating the active worker as activated until all the promises in the extend lifetime promises settle. (See step 12.3 of Activate algorithm.) This is primarily used to ensure that any functional events are not dispatched to the
ServiceWorkerGlobalScope
object that represents the service worker until it upgrades database schemas and deletes the outdated cache entries.- 4.5.
+InstallEvent
4.5.
InstallEvent
[Constructor(DOMString type, optional ExtendableEventInit eventInitDict), Exposed=ServiceWorker] -interface InstallEvent : ExtendableEvent { - void registerForeignFetch(ForeignFetchOptions options); +interface InstallEvent : ExtendableEvent { + void registerForeignFetch(ForeignFetchOptions options); }; -dictionary ForeignFetchOptions { +dictionary ForeignFetchOptions { required sequence<USVString> scopes; required sequence<USVString> origins; }; @@ -2841,7 +2841,7 @@scopes is empty throw a
TypeError
and abort these steps. -- Let scopeString be the context object’s relevant global object’s service worker’s containing service worker registration’s scope url, serialized. +
- Let scopeString be the context object’s relevant global object’s service worker’s containing service worker registration’s scope url, serialized.
- Let subScopeURLs be an empty list of URLs.
- For each subScope in options.
scopes
: @@ -2858,19 +2858,19 @@4.6.
FetchEvent
-[Constructor(DOMString type, FetchEventInit eventInitDict), Exposed=ServiceWorker] -interface FetchEvent : ExtendableEvent { - [SameObject] readonly attribute Request request; - readonly attribute DOMString clientId; - readonly attribute DOMString reservedClientId; - readonly attribute DOMString targetClientId; - readonly attribute boolean isReload; - - void respondWith(Promise<Response> r); +4.6.
+FetchEvent
[Constructor(DOMString type, FetchEventInit eventInitDict), Exposed=ServiceWorker] +interface FetchEvent : ExtendableEvent { + [SameObject] readonly attribute Request request; + readonly attribute DOMString clientId; + readonly attribute DOMString reservedClientId; + readonly attribute DOMString targetClientId; + readonly attribute boolean isReload; + + void respondWith(Promise<Response> r); };-dictionary FetchEventInit : ExtendableEventInit { +dictionary FetchEventInit : ExtendableEventInit { required Request request; DOMString clientId = ""; DOMString reservedClientId = ""; @@ -2878,39 +2878,39 @@-boolean isReload = false; };
Service workers have an essential functional event
-fetch
. Forfetch
event, service workers use theFetchEvent
interface which extends theExtendableEvent
interface.Each event using
+FetchEvent
interface has an associated potential response (a response), initially set to null, and the following associated flags that are initially unset:Service workers have an essential functional event
+fetch
. Forfetch
event, service workers use theFetchEvent
interface which extends theExtendableEvent
interface.Each event using
FetchEvent
interface has an associated potential response (a response), initially set to null, and the following associated flags that are initially unset:-
- wait to respond flag -
- respond-with entered flag -
- respond-with error flag +
- wait to respond flag +
- respond-with entered flag +
- respond-with error flag
- 4.6.1.
-event.request
+
request
attribute must return the value it was initialized to.4.6.1.
+event.request
request
attribute must return the value it was initialized to.- 4.6.2.
-event.clientId
+
clientId
attribute must return the value it was initialized to. When an event is created the attribute must be initialized to the empty string.4.6.2.
+event.clientId
clientId
attribute must return the value it was initialized to. When an event is created the attribute must be initialized to the empty string.- 4.6.3.
-event.reservedClientId
+
reservedClientId
attribute must return the value it was initialized to. When an event is created the attribute must be initialized to the empty string.4.6.3.
+event.reservedClientId
reservedClientId
attribute must return the value it was initialized to. When an event is created the attribute must be initialized to the empty string.- 4.6.4.
-event.targetClientId
+
targetClientId
attribute must return the value it was initialized to. When an event is created the attribute must be initialized to the empty string.4.6.4.
+event.targetClientId
targetClientId
attribute must return the value it was initialized to. When an event is created the attribute must be initialized to the empty string.- 4.6.5.
-event.isReload
+
isReload
attribute must return the value it was initialized to. When an event is created the attribute must be initialized to false.4.6.5.
+event.isReload
isReload
attribute must return the value it was initialized to. When an event is created the attribute must be initialized to false.Pressing the refresh button should be considered a reload while clicking a link and pressing the back button should not. The behavior of the Ctrl+l enter is left to the implementations of the user agents.
- 4.6.6.
+event.respondWith(r)
4.6.6.
event.respondWith(r)
Developers can set the argument r with either a promise that resolves with a
-Response
object or aResponse
object (which is automatically cast to a promise). Otherwise, a network error is returned to Fetch. Renderer-side security checks about tainting for cross-origin content are tied to the types of filtered responses defined in Fetch.+
respondWith(r)
method must run these steps:
respondWith(r)
method must run these steps:
- If the dispatch flag is unset, then: @@ -2919,17 +2919,17 @@
Abort these steps. - - If the respond-with entered flag is set, then: + If the respond-with entered flag is set, then:
- Throw an "
InvalidStateError
" exception.- Abort these steps.
- - Add r to the extend lifetime promises. -
+ Add r to the extend lifetime promises. +
event.respondWith(r)
extends the lifetime of the event by default as ifevent.waitUntil(r)
is called.
event.respondWith(r)
extends the lifetime of the event by default as ifevent.waitUntil(r)
is called.- Set the stop propagation flag and stop immediate propagation flag. -
- Set the respond-with entered flag. -
- Set the wait to respond flag. +
- Set the respond-with entered flag. +
- Set the wait to respond flag.
- Let targetRealm be the relevant Realm of the context object.
- Run the following substeps in parallel: @@ -2938,7 +2938,7 @@
If r rejected, then: -
- Set the respond-with error flag. +
- Set the respond-with error flag.
- If r resolved with response, then: @@ -2949,7 +2949,7 @@
If response is disturbed or locked, then: -
- Set the respond-with error flag. +
- Set the respond-with error flag.
- Else: @@ -2995,42 +2995,42 @@
Else: -
-- Set the respond-with error flag. +
- Set the respond-with error flag.
If the respond-with error flag is set, a network error is returned to Fetch through Handle Fetch algorithm. (See the step 21.1.) Otherwise, the value response is returned to Fetch through Handle Fetch algorithm. (See the step 22.1.)
+If the respond-with error flag is set, a network error is returned to Fetch through Handle Fetch algorithm. (See the step 21.1.) Otherwise, the value response is returned to Fetch through Handle Fetch algorithm. (See the step 22.1.)
-- Unset the wait to respond flag. +
- Unset the wait to respond flag.
- 4.7.
-ForeignFetchEvent
[Constructor(DOMString type, ForeignFetchEventInit eventInitDict), Exposed=ServiceWorker] -interface ForeignFetchEvent : ExtendableEvent { +4.7.
+ForeignFetchEvent
[Constructor(DOMString type, ForeignFetchEventInit eventInitDict), Exposed=ServiceWorker] +interface ForeignFetchEvent : ExtendableEvent { [SameObject] readonly attribute Request request; readonly attribute USVString origin; - void respondWith(Promise<ForeignFetchResponse> r); + void respondWith(Promise<ForeignFetchResponse> r); }; -dictionary ForeignFetchEventInit : ExtendableEventInit { +dictionary ForeignFetchEventInit : ExtendableEventInit { required Request request; USVString origin = "null"; }; -dictionary ForeignFetchResponse { +dictionary ForeignFetchResponse { required Response response; USVString origin; sequence<ByteString> headers; };-Service workers have a functional event
-foreignfetch
. Forforeignfetch
events, service workers use theForeignFetchEvent
interface which extends theExtendableEvent
interface.Each event using
+ForeignFetchEvent
interface has an associated potential response (a response), initially set to null, an associated origin (aUSVString
or null), initially set to null, an associated list of exposed headers (whose element type is a byte string), initially set to an empty list, and the following associated flags that are initially unset:Service workers have a functional event
+foreignfetch
. Forforeignfetch
events, service workers use theForeignFetchEvent
interface which extends theExtendableEvent
interface.Each event using
ForeignFetchEvent
interface has an associated potential response (a response), initially set to null, an associated origin (aUSVString
or null), initially set to null, an associated list of exposed headers (whose element type is a byte string), initially set to an empty list, and the following associated flags that are initially unset:-
- wait to respond flag -
- respond-with entered flag -
- respond-with error flag +
- wait to respond flag +
- respond-with entered flag +
- respond-with error flag
@@ -3053,15 +3053,15 @@ respond-with entered flag is set, then: + If the respond-with entered flag is set, then:
-
- Throw an "
InvalidStateError
" exception.- Abort these steps.
- Add r to the extend lifetime promises. +
- Add r to the extend lifetime promises.
- Set the stop propagation flag and stop immediate propagation flag. -
- Set the respond-with entered flag. -
- Set the wait to respond flag. +
- Set the respond-with entered flag. +
- Set the wait to respond flag.
- Let targetRealm be the relevant Realm of the context object.
- Run the following substeps in parallel: @@ -3070,20 +3070,20 @@
respond-with error flag. +
- Set the respond-with error flag.
- If r resolved with response, then:
-
- - If response is a
ForeignFetchResponse
, then: + If response is aForeignFetchResponse
, then:-
- Set the origin to response.
origin
. -- Set the list of exposed headers to response.
headers
. +- Set the list of exposed headers to response.
headers
.- If response.
response
is disturbed or locked, then:-
- Set the respond-with error flag. +
- Set the respond-with error flag.
- Else: @@ -3128,59 +3128,59 @@
respond-with error flag. +
- Set the respond-with error flag.
If the respond-with error flag is set, a network error is returned to Fetch through Handle Foreign Fetch algorithm. (See the step 19.1.) Otherwise, a filtered version of response is returned to Fetch through Handle Foreign Fetch algorithm. (See the step 20.1.)
+If the respond-with error flag is set, a network error is returned to Fetch through Handle Foreign Fetch algorithm. (See the step 19.1.) Otherwise, a filtered version of response is returned to Fetch through Handle Foreign Fetch algorithm. (See the step 20.1.)
- Unset the wait to respond flag. +
- Unset the wait to respond flag.
- 4.8.
-ExtendableMessageEvent
[Constructor(DOMString type, optional ExtendableMessageEventInit eventInitDict), Exposed=ServiceWorker] -interface ExtendableMessageEvent : ExtendableEvent { - readonly attribute any data; - readonly attribute USVString origin; - readonly attribute DOMString lastEventId; - [SameObject] readonly attribute (Client or ServiceWorker or MessagePort)? source; - readonly attribute FrozenArray<MessagePort> ports; +4.8.
+ExtendableMessageEvent
[Constructor(DOMString type, optional ExtendableMessageEventInit eventInitDict), Exposed=ServiceWorker] +interface ExtendableMessageEvent : ExtendableEvent { + readonly attribute any data; + readonly attribute USVString origin; + readonly attribute DOMString lastEventId; + [SameObject] readonly attribute (Client or ServiceWorker or MessagePort)? source; + readonly attribute FrozenArray<MessagePort> ports; };-dictionary ExtendableMessageEventInit : ExtendableEventInit { +dictionary ExtendableMessageEventInit : ExtendableEventInit { any data = null; USVString origin = ""; DOMString lastEventId = ""; - (Client or ServiceWorker or MessagePort)? source = null; + (Client or ServiceWorker or MessagePort)? source = null; sequence<MessagePort> ports = []; };-Service workers define the extendable message event that extends the
+message
event defined in [HTML] to allow extending the lifetime of the event. For the message event, service workers use theExtendableMessageEvent
interface which extends theExtendableEvent
interface.Service workers define the extendable message event that extends the
message
event defined in [HTML] to allow extending the lifetime of the event. For the message event, service workers use theExtendableMessageEvent
interface which extends theExtendableEvent
interface.- 4.8.1.
-event.data
The data attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to null. It represents the message being sent.
+4.8.1.
+event.data
The data attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to null. It represents the message being sent.
- 4.8.2.
-event.origin
The origin attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty string. It represents the origin of the service worker client that sent the message.
+4.8.2.
+event.origin
The origin attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty string. It represents the origin of the service worker client that sent the message.
- 4.8.3.
-event.lastEventId
The lastEventId attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty string.
+4.8.3.
+event.lastEventId
The lastEventId attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty string.
- 4.8.4.
-event.source
The source attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to null. It represents the
+Client
object from which the message is sent.4.8.4.
+event.source
The source attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to null. It represents the
Client
object from which the message is sent.- 4.8.5.
-event.ports
The ports attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty array. It represents the
+MessagePort
array being sent.4.8.5.
+event.ports
The ports attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty array. It represents the
MessagePort
array being sent.@@ -3233,7 +3233,7 @@ 4.9. Events
-The following events are dispatched on ServiceWorkerGlobalScope object:
+The following events are dispatched on
ServiceWorkerGlobalScope
object:
@@ -3190,23 +3190,23 @@
install
-InstallEvent
-[Lifecycle event] The service worker’s containing service worker registration’s installing worker changes. (See step 11.2 of the Install algorithm.) + InstallEvent
+[Lifecycle event] The service worker’s containing service worker registration’s installing worker changes. (See step 11.2 of the Install algorithm.) activate
-ExtendableEvent
-[Lifecycle event] The service worker’s containing service worker registration’s active worker changes. (See step 12.2 of the Activate algorithm.) + ExtendableEvent
+[Lifecycle event] The service worker’s containing service worker registration’s active worker changes. (See step 12.2 of the Activate algorithm.) fetch
-FetchEvent
-[Functional event] The http fetch invokes Handle Fetch with request. As a result of performing Handle Fetch, the service worker returns a response to the http fetch. The response, represented by a Response
object, can be retrieved from aCache
object or directly from network usingself.fetch(input, init)
method. (A customResponse
object can be another option.) +FetchEvent
+[Functional event] The http fetch invokes Handle Fetch with request. As a result of performing Handle Fetch, the service worker returns a response to the http fetch. The response, represented by a Response
object, can be retrieved from aCache
object or directly from network usingself.fetch(input, init)
method. (A customResponse
object can be another option.)foreignfetch
-FetchEvent
-[Functional event] The http fetch invokes Handle Foreign Fetch with request. As a result of performing Handle Foreign Fetch, the service worker returns a response to the http fetch. The response, represented by a Response
object, can be retrieved from aCache
object or directly from network usingself.fetch(input, init)
method. (A customResponse
object can be another option.) +FetchEvent
+[Functional event] The http fetch invokes Handle Foreign Fetch with request. As a result of performing Handle Foreign Fetch, the service worker returns a response to the http fetch. The response, represented by a Response
object, can be retrieved from aCache
object or directly from network usingself.fetch(input, init)
method. (A customResponse
object can be another option.)message
-ExtendableMessageEvent
+ExtendableMessageEvent
When it receives a message. When a serviceworker link’s
link
element is inserted into a document, a serviceworker link is created on alink
element that is already in a document tree, or thehref
orscope
attributes of thelink
element of a serviceworker link is changed, the user agent should run these steps:
- If the
href
attribute is the empty string, abort these steps. -- Let client be the document’s service worker client. +
- Let client be the document’s service worker client.
- If client is not a secure context, queue a task to fire an event named
error
at thelink
element, and abort these steps.- Let scriptURL be the result of parsing the
href
attribute with thelink
element’s node document’s document base URL.- Let scopeURL be null. @@ -3256,7 +3256,7 @@
Link: </js/sw.js>; rel="serviceworker"; scope="/"
has more or less the same effect as a document being loaded in a secure context with the following link
element:
<link rel="serviceworker" href="/js/sw.js" scope="/"> +<link rel="serviceworker" href="/js/sw.js" scope="/">which is more or less equivalent to the page containing javascript code like:
navigator.serviceworker.register("/js/sw.js", { scope: "/" }); @@ -3264,7 +3264,7 @@
- 5.2. Link element interface extensions
+5.2. Link element interface extensions
partial interface HTMLLinkElement { [CEReactions] attribute USVString scope; [CEReactions] attribute WorkerType workerType; @@ -3276,68 +3276,68 @@+
6. Caches
-To allow authors to fully manage their content caches for offline use, the
+Window
and theWorkerGlobalScope
provide the asynchronous caching methods that open and manipulateCache
objects. An origin can have multiple, namedCache
objects, whose contents are entirely under the control of scripts. Caches are not shared across origins, and they are completely isolated from the browser’s HTTP cache.To allow authors to fully manage their content caches for offline use, the
Window
and theWorkerGlobalScope
provide the asynchronous caching methods that open and manipulateCache
objects. An origin can have multiple, namedCache
objects, whose contents are entirely under the control of scripts. Caches are not shared across origins, and they are completely isolated from the browser’s HTTP cache.6.1. Constructs
A fetching record is a Record {[[key]], [[value]]} where [[key]] is a
Request
and [[value]] is aResponse
.A fetching record has an associated incumbent record (a fetching record). It is initially set to null.
A request to response map is a List of fetching records.
-A name to cache map is a List of the Record {[[key]], [[value]]} where [[key]] is a string that represents a name of the
+Cache
object and [[value]] is aCache
object.A name to cache map is a List of the Record {[[key]], [[value]]} where [[key]] is a string that represents a name of the
Cache
object and [[value]] is aCache
object.Each origin has an associated name to cache map.
6.2. Understanding Cache Lifetimes
-The
+Cache
instances are not part of the browser’s HTTP cache. TheCache
objects are exactly what authors have to manage themselves. TheCache
objects do not get updated unless authors explicitly request them to be. TheCache
objects do not expire unless authors delete the entries. TheCache
objects do not disappear just because the service worker script is updated. That is, caches are not updated automatically. Updates must be manually managed. This implies that authors should version their caches by name and make sure to use the caches only from the version of the service worker that can safely operate on.The
Cache
instances are not part of the browser’s HTTP cache. TheCache
objects are exactly what authors have to manage themselves. TheCache
objects do not get updated unless authors explicitly request them to be. TheCache
objects do not expire unless authors delete the entries. TheCache
objects do not disappear just because the service worker script is updated. That is, caches are not updated automatically. Updates must be manually managed. This implies that authors should version their caches by name and make sure to use the caches only from the version of the service worker that can safely operate on.6.3.
self.caches
partial interface WindowOrWorkerGlobalScope { - [SecureContext, SameObject] readonly attribute CacheStorage caches; + [SecureContext, SameObject] readonly attribute CacheStorage caches; };6.3.1.
-caches
+
caches
attribute must return this object’s associatedCacheStorage
object.
caches
attribute must return this object’s associatedCacheStorage
object.- 6.4.
+Cache
6.4.
Cache
[SecureContext, Exposed=(Window,Worker)] -interface Cache { - [NewObject] Promise<any> match(RequestInfo request, optional CacheQueryOptions options); - [NewObject] Promise<sequence<Response>> matchAll(optional RequestInfo request, optional CacheQueryOptions options); - [NewObject] Promise<void> add(RequestInfo request); - [NewObject] Promise<void> addAll(sequence<RequestInfo> requests); - [NewObject] Promise<void> put(RequestInfo request, Response response); - [NewObject] Promise<boolean> delete(RequestInfo request, optional CacheQueryOptions options); - [NewObject] Promise<sequence<Request>> keys(optional RequestInfo request, optional CacheQueryOptions options); +interface Cache { + [NewObject] Promise<any> match(RequestInfo request, optional CacheQueryOptions options); + [NewObject] Promise<sequence<Response>> matchAll(optional RequestInfo request, optional CacheQueryOptions options); + [NewObject] Promise<void> add(RequestInfo request); + [NewObject] Promise<void> addAll(sequence<RequestInfo> requests); + [NewObject] Promise<void> put(RequestInfo request, Response response); + [NewObject] Promise<boolean> delete(RequestInfo request, optional CacheQueryOptions options); + [NewObject] Promise<sequence<Request>> keys(optional RequestInfo request, optional CacheQueryOptions options); };-dictionary CacheQueryOptions { +dictionary CacheQueryOptions { boolean ignoreSearch = false; boolean ignoreMethod = false; boolean ignoreVary = false; DOMString cacheName; };-dictionary CacheBatchOperation { +dictionary CacheBatchOperation { DOMString type; Request request; Response response; - CacheQueryOptions options; + CacheQueryOptions options; };-A
-Cache
object represents a request to response map. Multiple separate objects implementing theCache
interface across documents and workers can all be associated with the same request to response map simultaneously.+
Cache
objects are always enumerable viaself.caches
in insertion order (per ECMAScript 6 Map objects).A
+Cache
object represents a request to response map. Multiple separate objects implementing theCache
interface across documents and workers can all be associated with the same request to response map simultaneously.
Cache
objects are always enumerable viaself.caches
in insertion order (per ECMAScript 6 Map objects).- 6.4.1.
-match(request, options)
+
match(request, options)
method must run these steps:6.4.1.
+match(request, options)
match(request, options)
method must run these steps:
- Let promise be a new promise.
- Run these substeps in parallel:
-
- Let p be the result of running the algorithm specified in
matchAll(request, options)
method with request and options as the arguments. +- Let p be the result of running the algorithm specified in
matchAll(request, options)
method with request and options as the arguments.- Wait until p settles.
- If p rejects with an exception, then: @@ -3363,8 +3363,8 @@
-
6.4.2.
-matchAll(request, options)
+
matchAll(request, options)
method must run these steps:6.4.2.
+matchAll(request, options)
matchAll(request, options)
method must run these steps:
- Let r be null.
- @@ -3417,17 +3417,17 @@
-
6.4.3.
-add(request)
+
add(request)
method must run these steps:6.4.3.
+add(request)
add(request)
method must run these steps:
- Let requests be an array containing only request. -
- Set responseArrayPromise to the result of running the algorithm specified in
addAll(requests)
passing requests as the argument. +- Set responseArrayPromise to the result of running the algorithm specified in
addAll(requests)
passing requests as the argument.- Return the result of transforming responseArrayPromise with a fulfillment handler that returns undefined.
- 6.4.4.
-addAll(requests)
+
addAll(requests)
method must run these steps:6.4.4.
+addAll(requests)
addAll(requests)
method must run these steps:
- Let responsePromiseArray be an empty array.
- Let requestArray be an empty array. @@ -3487,7 +3487,7 @@
CacheBatchOperation dictionary. +
- Let o be an empty object representing a
CacheBatchOperation
dictionary.- Set the
type
dictionary member of o to "put".- Set the
request
dictionary member of o to requestArray[index].- Set the
response
dictionary member of o to response. @@ -3543,8 +3543,8 @@-
6.4.5.
-put(request, response)
+
put(request, response)
method must run these steps:6.4.5.
+put(request, response)
put(request, response)
method must run these steps:
- Let r be null.
- @@ -3580,7 +3580,7 @@
Read all bytes from dummyStream with reader.
- Let operations be an empty array. -
- Let o be an empty object representing a
CacheBatchOperation
dictionary. +- Let o be an empty object representing a
CacheBatchOperation
dictionary.- Set the
type
dictionary member of o to "put".- Set the
request
dictionary member of o to aRequest
object associated with r.- Set the
response
dictionary member of o to newResponse. @@ -3621,8 +3621,8 @@-
6.4.6.
-delete(request, options)
+
delete(request, options)
method must run these steps:6.4.6.
+delete(request, options)
delete(request, options)
method must run these steps:
- Let r be null.
- @@ -3637,7 +3637,7 @@
request of the result of invoking the initial value of
Request
as constructor with request as its argument. If this throws an exception, return a promise rejected with that exception.- Let operations be an empty array. -
- Let o be an empty object representing a
CacheBatchOperation
dictionary. +- Let o be an empty object representing a
CacheBatchOperation
dictionary.- Set the
type
dictionary member of o to "delete".- Set the
request
dictionary member of o to aRequest
object associated with r.- Set the
options
dictionary member of o to options. @@ -3652,8 +3652,8 @@-
6.4.7.
-keys(request, options)
+
keys(request, options)
method must run these steps:6.4.7.
+keys(request, options)
keys(request, options)
method must run these steps:
- Let promise be a new promise.
- @@ -3698,22 +3698,22 @@
6.5.
CacheStorage
6.5.
CacheStorage
[SecureContext, Exposed=(Window,Worker)] -interface CacheStorage { - [NewObject] Promise<any> match(RequestInfo request, optional CacheQueryOptions options); - [NewObject] Promise<boolean> has(DOMString cacheName); - [NewObject] Promise<Cache> open(DOMString cacheName); - [NewObject] Promise<boolean> delete(DOMString cacheName); - [NewObject] Promise<sequence<DOMString>> keys(); +interface CacheStorage { + [NewObject] Promise<any> match(RequestInfo request, optional CacheQueryOptions options); + [NewObject] Promise<boolean> has(DOMString cacheName); + [NewObject] Promise<Cache> open(DOMString cacheName); + [NewObject] Promise<boolean> delete(DOMString cacheName); + [NewObject] Promise<sequence<DOMString>> keys(); };--
CacheStorage
interface is designed to largely conform to ECMAScript 6 Map objects but entirely async, and with additional convenience methods. The methods,clear
,forEach
,entries
andvalues
, are intentionally excluded from the scope of the first version resorting to the ongoing discussion about the async iteration by TC39.The user agent must create a
-CacheStorage
object when aWindow
object or aWorkerGlobalScope
object is created and associate it with that global object.A
+CacheStorage
object represents a name to cache map of its associated global object’s environment settings object’s origin. Multiple separate objects implementing theCacheStorage
interface across documents and workers can all be associated with the same name to cache map simultaneously.+
CacheStorage
interface is designed to largely conform to ECMAScript 6 Map objects but entirely async, and with additional convenience methods. The methods,clear
,forEach
,entries
andvalues
, are intentionally excluded from the scope of the first version resorting to the ongoing discussion about the async iteration by TC39.The user agent must create a
+CacheStorage
object when aWindow
object or aWorkerGlobalScope
object is created and associate it with that global object.A
CacheStorage
object represents a name to cache map of its associated global object’s environment settings object’s origin. Multiple separate objects implementing theCacheStorage
interface across documents and workers can all be associated with the same name to cache map simultaneously.- 6.5.1.
-match(request, options)
+
match(request, options)
method must run these steps:6.5.1.
+match(request, options)
match(request, options)
method must run these steps:@@ -3745,7 +3745,7 @@
- If options.
cacheName
is present, then: @@ -3727,7 +3727,7 @@If options.
cacheName
matches entry.[[key]], then:-
- Resolve p with the result of running the algorithm specified in
match(request, options)
method ofCache
interface with request and options as the arguments (providing entry.[[value]] as thisArgument to the [[Call]] internal method ofmatch(request, options)
.) +- Resolve p with the result of running the algorithm specified in
match(request, options)
method ofCache
interface with request and options as the arguments (providing entry.[[value]] as thisArgument to the [[Call]] internal method ofmatch(request, options)
.)- Abort these steps.
p to the result of transforming itself with a fulfillment handler that, when called with argument v, performs the following substeps in parallel:
- If v is not undefined, return v. -
- Return the result of running the algorithm specified in
match(request, options)
method ofCache
interface with request and options as the arguments (providing entry.[[value]] as thisArgument to the [[Call]] internal method ofmatch(request, options)
.) +- Return the result of running the algorithm specified in
match(request, options)
method ofCache
interface with request and options as the arguments (providing entry.[[value]] as thisArgument to the [[Call]] internal method ofmatch(request, options)
.)- Return p. @@ -3753,8 +3753,8 @@
- 6.5.2.
-has(cacheName)
+
has(cacheName)
method must run these steps:6.5.2.
+has(cacheName)
has(cacheName)
method must run these steps:
- Return a promise p resolved with the result of running the following substeps: @@ -3773,8 +3773,8 @@
- 6.5.3.
-open(cacheName)
+
open(cacheName)
method must run these steps:6.5.3.
+open(cacheName)
open(cacheName)
method must run these steps:-
- Let p be a new promise.
- @@ -3786,11 +3786,11 @@
If cacheName matches entry.[[key]], then:
- Let cache be a new
Cache
object. +- Let cache be a new
Cache
object.- Set a newly-created Record {[[key]]: cacheName, [[value]]: cache} to name to cache map. If this cache write operation failed due to exceeding the granted quota limit, reject p with a "
QuotaExceededError
" exception and abort these steps.- Resolve p with cache. @@ -3798,10 +3798,10 @@
- 6.5.4.
-delete(cacheName)
+
delete(cacheName)
method must run these steps:6.5.4.
+delete(cacheName)
delete(cacheName)
method must run these steps:-
- Let p be the result of running the algorithm specified in
has(cacheName)
method with cacheName as the argument. +- Let p be the result of running the algorithm specified in
has(cacheName)
method with cacheName as the argument.- Return the result of transforming p with a fulfillment handler that, when called with argument cacheExists, performs the following substeps in parallel:
@@ -3822,8 +3822,8 @@
- 6.5.5.
-keys()
+
keys()
method must run these steps:6.5.5.
+keys()
keys()
method must run these steps:The promise returned from this method resolves with the sequence of keys, cache names in DOMString, in insertion order.
- Let resultArray be an empty array. @@ -3866,9 +3866,9 @@
7.3.2.
-importScripts(urls)
When the
+importScripts(urls)
method is called on aServiceWorkerGlobalScope
object, the user agent must import scripts into worker global scope, given thisServiceWorkerGlobalScope
object and urls, and with the following steps to perform the fetch given the request request:When the
importScripts(urls)
method is called on aServiceWorkerGlobalScope
object, the user agent must import scripts into worker global scope, given thisServiceWorkerGlobalScope
object and urls, and with the following steps to perform the fetch given the request request:-
- Let serviceWorker be request’s client’s global object’s service worker. +
- Let serviceWorker be request’s client’s global object’s service worker.
- If serviceWorker’s imported scripts updated flag is unset, then:
This section is non-normative.
Applications tend to cache items that come from a CDN or other origin. It is possible to request many of them directly using
-<script>
,<img>
,<video>
and<link>
elements. It would be hugely limiting if this sort of runtime collaboration broke when offline. Similarly, it is possible to fetch many sorts of off-origin resources when appropriate CORS headers are set.Service workers enable this by allowing
+Caches
to fetch and cache off-origin items. Some restrictions apply, however. First, unlike same-origin resources which are managed in theCache
asResponse
objects whose corresponding responses are basic filtered response, the objects stored areResponse
objects whose corresponding responses are either CORS filtered responses or opaque filtered responses. They can be passed toevent.respondWith(r)
method in the same manner as theResponse
objects whose corresponding responses are basic filtered responses, but cannot be meaningfully created programmatically. These limitations are necessary to preserve the security invariants of the platform. AllowingCaches
to store them allows applications to avoid re-architecting in most cases.Service workers enable this by allowing
Caches
to fetch and cache off-origin items. Some restrictions apply, however. First, unlike same-origin resources which are managed in theCache
asResponse
objects whose corresponding responses are basic filtered response, the objects stored areResponse
objects whose corresponding responses are either CORS filtered responses or opaque filtered responses. They can be passed toevent.respondWith(r)
method in the same manner as theResponse
objects whose corresponding responses are basic filtered responses, but cannot be meaningfully created programmatically. These limitations are necessary to preserve the security invariants of the platform. AllowingCaches
to store them allows applications to avoid re-architecting in most cases.@@ -4157,7 +4157,7 @@ 7.5. Implementer Concerns
@@ -3920,7 +3920,7 @@Service workers are extensible from other specifications.
9.1. Define API bound to Service Worker Registration
-Specifications may define an API tied to a service worker registration by using partial interface definition to the
+ServiceWorkerRegistration
interface where it may define the specification specific attributes and methods:Specifications may define an API tied to a service worker registration by using partial interface definition to the
ServiceWorkerRegistration
interface where it may define the specification specific attributes and methods:partial interface ServiceWorkerRegistration { // e.g. define an API namespace readonly attribute APISpaceType APISpace; @@ -3931,7 +3931,7 @@9.2. Define Functional Event
-Specifications may define a functional event by extending
+ExtendableEvent
interface:Specifications may define a functional event by extending
ExtendableEvent
interface:// e.g. define FunctionalEvent interface interface FunctionalEvent : ExtendableEvent { // add a functional event’s own attributes and methods @@ -3940,7 +3940,7 @@
9.3. Define Event Handler
-Specifications may define an event handler attribute for the corresponding functional event using partial interface definition to the
+ServiceWorkerGlobalScope
interface:Specifications may define an event handler attribute for the corresponding functional event using partial interface definition to the
ServiceWorkerGlobalScope
interface:partial interface ServiceWorkerGlobalScope { attribute EventHandler onfunctionalevent; }; @@ -3949,7 +3949,7 @@9.4. Request Functional Event Dispatch
To request a functional event dispatch to a service worker, specifications may invoke Handle Functional Event algorithm with its service worker registration registration and the algorithm callbackSteps as the arguments.
-Specifications may define an algorithm callbackSteps where the corresponding functional event can be created and fired with specification specific objects. The algorithm is passed globalObject (a
+ServiceWorkerGlobalScope
object) at which it may fire its functional events. This algorithm is called on a task queued by Handle Functional Event algorithm.Specifications may define an algorithm callbackSteps where the corresponding functional event can be created and fired with specification specific objects. The algorithm is passed globalObject (a
ServiceWorkerGlobalScope
object) at which it may fire its functional events. This algorithm is called on a task queued by Handle Functional Event algorithm.See an example hook defined in Notifications API.
Regist
- If newestWorker is not null and job’s script url equals newestWorker’s script url with the exclude fragments flag set, then:
-
@@ -4272,7 +4272,7 @@- Invoke Resolve Job Promise with job and the
ServiceWorkerRegistration
object which represents registration. +- Invoke Resolve Job Promise with job and the
ServiceWorkerRegistration
object which represents registration.- Invoke Finish Job with job and abort these steps.
Update
- If newestWorker is not null, newestWorker’s script url equals job’s script url with the exclude fragments flag set, and script is a byte-for-byte match with newestWorker’s script resource, then:
-
- Invoke Resolve Job Promise with job and the
ServiceWorkerRegistration
object which represents registration. +- Invoke Resolve Job Promise with job and the
ServiceWorkerRegistration
object which represents registration.- Invoke Finish Job with job and abort these steps.
- @@ -4332,20 +4332,20 @@
In
- Run the Update Registration State algorithm passing registration, "
installing
" and worker as the arguments.- Run the Update Worker State algorithm passing registration’s installing worker and installing as the arguments.
- Assert: job’s promise is not null. -
- Invoke Resolve Job Promise with job and the
ServiceWorkerRegistration
object which represents registration. -- Queue a task to fire an event named
updatefound
at all theServiceWorkerRegistration
objects for all the service worker clients whose creation URL matches registration’s scope url and all the service workers whose containing service worker registration is registration. +- Invoke Resolve Job Promise with job and the
ServiceWorkerRegistration
object which represents registration. +- Queue a task to fire an event named
updatefound
at all theServiceWorkerRegistration
objects for all the service worker clients whose creation URL matches registration’s scope url and all the service workers whose containing service worker registration is registration.- Let installingWorker be registration’s installing worker.
- Invoke Run Service Worker algorithm with installingWorker as the argument.
- Queue a task task to run the following substeps:
-
- Create a trusted event e that uses the
InstallEvent
interface, with the event typeinstall
, which does not bubble and is not cancelable. +- Create a trusted event e that uses the
InstallEvent
interface, with the event typeinstall
, which does not bubble and is not cancelable.- Dispatch e at installingWorker’s environment settings object’s global object globalObject.
- WaitForAsynchronousExtensions: Run the following substeps in parallel:
- Wait until e’s extensions allowed flag is unset. -
- If the result of waiting for all of e’s extend lifetime promises rejected, set installFailed to true. +
- If the result of waiting for all of e’s extend lifetime promises rejected, set installFailed to true.
If task is discarded or the script has been aborted by the termination of installingWorker, set installFailed to true.
@@ -4426,7 +4426,7 @@Acti
- Queue a task task to run the following substeps:
-
@@ -4451,7 +4451,7 @@- Create a trusted event e that uses the
ExtendableEvent
interface, with the event typeactivate
, which does not bubble and is not cancelable. +- Create a trusted event e that uses the
ExtendableEvent
interface, with the event typeactivate
, which does not bubble and is not cancelable.- Dispatch e at activeWorker’s environment settings object’s global object.
- WaitForAsynchronousExtensions: Wait, in parallel, until e’s extensions allowed flag is unset.
InitializeHostDefinedRealm() abstract operation with the following customizations:
-
- For the global object, create a new
ServiceWorkerGlobalScope
object. Let workerGlobalScope be the created object. +- For the global object, create a new
ServiceWorkerGlobalScope
object. Let workerGlobalScope be the created object.- Let realmExecutionContext be the created JavaScript execution context.
- Let workerEventLoop be a newly created event loop. @@ -4490,7 +4490,7 @@
has ever been evaluated flag is unset, then:
@@ -4577,19 +4577,19 @@
- - Set workerGlobalScope’s associated service worker’s set of event types to handle to the set of event types created from settingsObject’s global object’s associated list of event listeners' event types. + Set workerGlobalScope’s associated service worker’s set of event types to handle to the set of event types created from settingsObject’s global object’s associated list of event listeners' event types.
If the global object’s associated list of event listeners does not have any event listener added at this moment, the service worker’s set of event types to handle is set to an empty set. The user agents are encouraged to show a warning that the event listeners must be added on the very first evaluation of the worker script.
- Set script’s has ever been evaluated flag.
Queue a task task to run the following substeps:
-
- Create a trusted event e that uses the
FetchEvent
interface, with the event typefetch
, which does not bubble. -- Let the request attribute of e be initialized to r. -
- Initialize e’s
clientId
attribute to client’s id. -- If request is a non-subresource request and request’s destination is not "
report
", initialize e’sreservedClientId
attribute to reservedClient’s id, and to the empty string otherwise. -- If request is a navigation request, initialize e’s
targetClientId
attribute to request’s target client id, and to the empty string otherwise. -- Let the isReload attribute of e be initialized to
true
if request’s client is a window client and the event was dispatched with the user’s intention for the page reload, andfalse
otherwise. +- Create a trusted event e that uses the
FetchEvent
interface, with the event typefetch
, which does not bubble. +- Let the
request
attribute of e be initialized to r. +- Initialize e’s
clientId
attribute to client’s id. +- If request is a non-subresource request and request’s destination is not "
report
", initialize e’sreservedClientId
attribute to reservedClient’s id, and to the empty string otherwise. +- If request is a navigation request, initialize e’s
targetClientId
attribute to request’s target client id, and to the empty string otherwise. +- Let the
isReload
attribute of e be initialized totrue
if request’s client is a window client and the event was dispatched with the user’s intention for the page reload, andfalse
otherwise.- Dispatch e at activeWorker’s environment settings object’s global object. -
- If e’s respond-with entered flag is set, set respondWithEntered to true. +
- If e’s respond-with entered flag is set, set respondWithEntered to true.
- - If e’s wait to respond flag is set, then: + If e’s wait to respond flag is set, then:
-
- Wait until e’s wait to respond flag is unset. -
- If e’s respond-with error flag is set, set handleFetchFailed to true. +
- Wait until e’s wait to respond flag is unset. +
- If e’s respond-with error flag is set, set handleFetchFailed to true.
- Else, set response to e’s potential response.
- If e’s canceled flag is set, set eventCanceled to true. @@ -4657,19 +4657,19 @@
Queue a task task to run the following substeps:
-
- Create a trusted event e that uses the
ForeignFetchEvent
interface, with the event typeforeignfetch
, which does not bubble. +- Create a trusted event e that uses the
ForeignFetchEvent
interface, with the event typeforeignfetch
, which does not bubble.- Let the
request
attribute of e be initialized to r.- Let the
origin
attribute of e be initialized to the Unicode serialization of request’s origin.- Dispatch e at activeWorker’s environment settings object’s global object. -
- If e’s respond-with entered flag is set, set respondWithEntered to true. -
- If e’s wait to respond flag is set, wait until e’s wait to respond flag is unset. +
- If e’s respond-with entered flag is set, set respondWithEntered to true. +
- If e’s wait to respond flag is set, wait until e’s wait to respond flag is unset.
- Let internalResponse be e’s potential response.
- If internalResponse is a filtered response, set internalResponse to internalResponse’s internal response. -
- If e’s respond-with error flag is set, set handleFetchFailed to true. +
- If e’s respond-with error flag is set, set handleFetchFailed to true.
- Else if e’s origin is null:
-
@@ -4679,7 +4679,7 @@- If e’s list of exposed headers is not empty, set handleFetchFailed to true. +
- If e’s list of exposed headers is not empty, set handleFetchFailed to true.
- Else if e’s potential response is a opaque-redirect filtered response, set response to e’s potential response.
- Else set response to an opaque filtered response of internalResponse.
list of exposed headers. +
- Let headers be e’s list of exposed headers.
- If response is a CORS filtered response, remove from internalResponse’s CORS-exposed header-name list all values not in headers.
- Else set internalResponse’s CORS-exposed header-name list to headers.
- Set response to a CORS filtered response of internalResponse. @@ -4719,7 +4719,7 @@
Handle Functional Event
- Input -
- registration, a service worker registration +
- registration, a service worker registration
- callbackSteps, an algorithm
- Output
- None @@ -4883,7 +4883,7 @@
None
-
- Let registrationObjects be an array containing all the
ServiceWorkerRegistration
objects associated with registration. +- Let registrationObjects be an array containing all the
ServiceWorkerRegistration
objects associated with registration.- If target is "
installing
", then:@@ -4891,7 +4891,7 @@
For each registrationObject in registrationObjects:
-
- Queue a task to set the installing attribute of registrationObject to the
ServiceWorker
object that represents registration’s installing worker, or null if registration’s installing worker is null. +- Queue a task to set the
installing
attribute of registrationObject to theServiceWorker
object that represents registration’s installing worker, or null if registration’s installing worker is null.- @@ -4901,7 +4901,7 @@
For each registrationObject in registrationObjects:
-
- Queue a task to set the waiting attribute of registrationObject to the
ServiceWorker
object that represents registration’s waiting worker, or null if registration’s waiting worker is null. +- Queue a task to set the
waiting
attribute of registrationObject to theServiceWorker
object that represents registration’s waiting worker, or null if registration’s waiting worker is null.- @@ -4911,7 +4911,7 @@
For each registrationObject in registrationObjects:
-
- Queue a task to set the active attribute of registrationObject to the
ServiceWorker
object that represents registration’s active worker, or null if registration’s active worker is null. +- Queue a task to set the
active
attribute of registrationObject to theServiceWorker
object that represents registration’s active worker, or null if registration’s active worker is null.The task must use registrationObject’s relevant settings object’s responsible event loop and the DOM manipulation task source.
@@ -4928,7 +4928,7 @@Up
- Set worker’s state to state. -
- Let workerObjects be an array containing all the
ServiceWorker
objects associated with worker. +- Let workerObjects be an array containing all the
ServiceWorker
objects associated with worker.- For each workerObject in workerObjects:
@@ -4936,12 +4936,12 @@
Up Queue a task to run these substeps:
- - Set the state attribute of workerObject to the value (in
ServiceWorkerState
enumeration) corresponding to the first matching statement, switching on worker’s state: + Set thestate
attribute of workerObject to the value (inServiceWorkerState
enumeration) corresponding to the first matching statement, switching on worker’s state:
- installing
- "
installing
" -The service worker in this state is considered an installing worker. During this state,
+event.waitUntil(f)
can be called inside theoninstall
event handler to extend the life of the installing worker until the passed promise resolves successfully. This is primarily used to ensure that the service worker is not active until all of the core caches are populated.The service worker in this state is considered an installing worker. During this state,
event.waitUntil(f)
can be called inside theoninstall
event handler to extend the life of the installing worker until the passed promise resolves successfully. This is primarily used to ensure that the service worker is not active until all of the core caches are populated.- installed
- "
installed
" @@ -4949,7 +4949,7 @@Up
- activating
- "
activating
" -The service worker in this state is considered an active worker. During this state,
+event.waitUntil(f)
can be called inside theonactivate
event handler to extend the life of the active worker until the passed promise resolves successfully. No functional events are dispatched until the state becomes activated.The service worker in this state is considered an active worker. During this state,
event.waitUntil(f)
can be called inside theonactivate
event handler to extend the life of the active worker until the passed promise resolves successfully. No functional events are dispatched until the state becomes activated.- activated
- "
activated
" @@ -4975,7 +4975,7 @@
- Assert: client is not null. -
- If client is a type of environment settings object, queue a task to fire an event named
controllerchange
at theServiceWorkerContainer
object client is associated with. +- If client is a type of environment settings object, queue a task to fire an event named
controllerchange
at theServiceWorkerContainer
object client is associated with.The task must use client’s responsible event loop and the DOM manipulation task source.
@@ -5069,11 +5069,11 @@C
- Input
- client, a service worker client
- Output -
- clientObject, a
Client
object +- clientObject, a
Client
object-
@@ -5086,11 +5086,11 @@- Let clientObject be a new
Client
object. -- Set clientObject’s service worker client to client. +
- Let clientObject be a new
Client
object. +- Set clientObject’s service worker client to client.
- Return clientObject.
WindowClient object +
- windowClient, a
WindowClient
object-
- Let windowClient be a new
WindowClient
object. -- Set windowClient’s service worker client to client. +
- Let windowClient be a new
WindowClient
object. +- Set windowClient’s service worker client to client.
- Set windowClient’s visibility state to visibilityState.
- Set windowClient’s focus state to focusState.
- Set windowClient’s ancestor origins array to ancestorOrigins. @@ -5102,7 +5102,7 @@
Que
- Input
- request, a
Request
object -- options, a
CacheQueryOptions
object, optional +- options, a
CacheQueryOptions
object, optional- targetStorage, an array that has [
Request
,Response
] pairs as its elements, optional- Output
- resultArray, an array that has [
Request
,Response
] pairs as its elements @@ -5188,7 +5188,7 @@Que
Batch Cache Operations
@@ -5373,87 +5373,87 @@
- Input -
- operations, an array of
CacheBatchOperation
dictionary objects +- operations, an array of
CacheBatchOperation
dictionary objects- Output
- promise, a promise resolves with an array of
Response
objects."activated", in §3.1
- activating, in §3.1
- "activating", in §3.1 -
- active, in §3.2.3 +
- active, in §3.2.3
- active worker, in §2.2 -
- addAll(requests), in §6.4.4 -
- add(request), in §6.4.3 +
- addAll(requests), in §6.4.4 +
- add(request), in §6.4.3
- all, in §4.3
- "all", in §4.3 -
- ancestorOrigins, in §4.2.7 +
- ancestorOrigins, in §4.2.7
- ancestor origins array, in §4.2 -
- Cache, in §6.4 -
- CacheBatchOperation, in §6.4 +
- Cache, in §6.4 +
- CacheBatchOperation, in §6.4
- cacheName, in §6.4 -
- CacheQueryOptions, in §6.4 +
- CacheQueryOptions, in §6.4
- caches, in §6.3.1 -
- CacheStorage, in §6.5 -
- claim(), in §4.3.4 -
- Client, in §4.2 +
- CacheStorage, in §6.5 +
- claim(), in §4.3.4 +
- Client, in §4.2
- client, in §Unnumbered section
- clientId
- dict-member for FetchEventInit, in §4.6 -
- attribute for FetchEvent, in §4.6.2 +
- attribute for FetchEvent, in §4.6.2
- client message queue, in §3.4 -
- ClientQueryOptions, in §4.3 -
- Clients, in §4.3 -
- clients, in §4.1.1 -
- ClientType, in §4.3 +
- ClientQueryOptions, in §4.3 +
- Clients, in §4.3 +
- clients, in §4.1.1 +
- ClientType, in §4.3
- containing service worker registration, in §2.1
- control, in §2.4 -
- controller, in §3.4.1 +
- controller, in §3.4.1
- controllerchange, in §3.6
- data
- dict-member for ServiceWorkerMessageEventInit, in §3.5 -
- attribute for ServiceWorkerMessageEvent, in §3.5.1 +
- attribute for ServiceWorkerMessageEvent, in §3.5.1
- dict-member for ExtendableMessageEventInit, in §4.8 -
- attribute for ExtendableMessageEvent, in §4.8.1 +
- attribute for ExtendableMessageEvent, in §4.8.1
- dedicated worker client, in §2.3 -
- delete(cacheName), in §6.5.4 -
- delete(request), in §6.4.6 -
- delete(request, options), in §6.4.6 +
- delete(cacheName), in §6.5.4 +
- delete(request), in §6.4.6 +
- delete(request, options), in §6.4.6
- equivalent, in §Unnumbered section -
- ExtendableEvent, in §4.4 +
- ExtendableEvent, in §4.4
- ExtendableEventInit, in §4.4
- ExtendableEvent(type), in §4.4
- ExtendableEvent(type, eventInitDict), in §4.4 -
- ExtendableMessageEvent, in §4.8 -
- ExtendableMessageEventInit, in §4.8 +
- ExtendableMessageEvent, in §4.8 +
- ExtendableMessageEventInit, in §4.8
- ExtendableMessageEvent(type), in §4.8
- ExtendableMessageEvent(type, eventInitDict), in §4.8 -
- extend lifetime promises, in §4.4 +
- extend lifetime promises, in §4.4
- extensions allowed flag, in §4.4
- fetch, in §4.9 -
- FetchEvent, in §4.6 -
- FetchEventInit, in §4.6 +
- FetchEvent, in §4.6 +
- FetchEventInit, in §4.6
- FetchEvent(type, eventInitDict), in §4.6
- fetching record, in §6.1 -
- focus(), in §4.2.8 -
- focused, in §4.2.6 +
- focus(), in §4.2.8 +
- focused, in §4.2.6
- focus state, in §4.2
- force bypass cache flag, in §Unnumbered section
- foreignfetch, in §4.9 -
- ForeignFetchEvent, in §4.7 -
- ForeignFetchEventInit, in §4.7 +
- ForeignFetchEvent, in §4.7 +
- ForeignFetchEventInit, in §4.7
- ForeignFetchEvent(type, eventInitDict), in §4.7 -
- ForeignFetchOptions, in §4.5 -
- ForeignFetchResponse, in §4.7 +
- ForeignFetchOptions, in §4.5 +
- ForeignFetchResponse, in §4.7
- functional events, in §2.1 -
- get(id), in §4.3.1 -
- getRegistration(), in §3.4.4 -
- getRegistration(clientURL), in §3.4.4 -
- getRegistrations(), in §3.4.5 +
- get(id), in §4.3.1 +
- getRegistration(), in §3.4.4 +
- getRegistration(clientURL), in §3.4.4 +
- getRegistrations(), in §3.4.5
- global object, in §6.5
- Handle Fetch, in §Unnumbered section
- handle fetch task source, in §2.5
- Handle Foreign Fetch, in §Unnumbered section
- handle functional event task source, in §2.5 -
- has(cacheName), in §6.5.2 +
- has(cacheName), in §6.5.2
- has ever been evaluated flag, in §2.1
- headers, in §4.7
- HTTPS state, in §2.1 @@ -5461,7 +5461,7 @@
dfn for service worker, in §2.1 -
- attribute for Client, in §4.2.2 +
- attribute for Client, in §4.2.2
- ignoreMethod, in §6.4
- ignoreSearch, in §6.4 @@ -5474,7 +5474,7 @@
install, in §4.9
- installed, in §3.1
- "installed", in §3.1 -
- InstallEvent, in §4.5 +
- InstallEvent, in §4.5
- InstallEvent(type), in §4.5
- InstallEvent(type, eventInitDict), in §4.5
- "installing", in §3.1 @@ -5482,14 +5482,14 @@
enum-value for ServiceWorkerState, in §3.1 -
- attribute for ServiceWorkerRegistration, in §3.2.1 +
- attribute for ServiceWorkerRegistration, in §3.2.1
- installing worker, in §2.2
- isReload
- dict-member for FetchEventInit, in §4.6 -
- attribute for FetchEvent, in §4.6.5 +
- attribute for FetchEvent, in §4.6.5
- job, in §Unnumbered section
- job promise, in §Unnumbered section @@ -5498,45 +5498,45 @@
method for Cache, in §6.4.7 -
- method for CacheStorage, in §6.5.5 +
- method for Cache, in §6.4.7 +
- method for CacheStorage, in §6.5.5 -
- keys(request), in §6.4.7 -
- keys(request, options), in §6.4.7 +
- keys(request), in §6.4.7 +
- keys(request, options), in §6.4.7
- lastEventId
- dict-member for ServiceWorkerMessageEventInit, in §3.5 -
- attribute for ServiceWorkerMessageEvent, in §3.5.3 +
- attribute for ServiceWorkerMessageEvent, in §3.5.3
- dict-member for ExtendableMessageEventInit, in §4.8 -
- attribute for ExtendableMessageEvent, in §4.8.3 +
- attribute for ExtendableMessageEvent, in §4.8.3
- last update check time, in §2.2
- lifecycle events, in §2.1
- list of equivalent jobs, in §Unnumbered section -
- list of exposed headers, in §4.7 +
- list of exposed headers, in §4.7
- list of foreign fetch origins, in §2.1
- list of foreign fetch scopes, in §2.1
- matchAll()
-
-- method for Clients, in §4.3.2 -
- method for Cache, in §6.4.2 +
- method for Clients, in §4.3.2 +
- method for Cache, in §6.4.2
- matchAll(options), in §4.3.2 -
- matchAll(request), in §6.4.2 -
- matchAll(request, options), in §6.4.2 +
- matchAll(options), in §4.3.2 +
- matchAll(request), in §6.4.2 +
- matchAll(request, options), in §6.4.2
- match(request)
-
- method for Cache, in §6.4.1 -
- method for CacheStorage, in §6.5.1 +
- method for Cache, in §6.4.1 +
- method for CacheStorage, in §6.5.1
- match(request, options)
-
- method for Cache, in §6.4.1 -
- method for CacheStorage, in §6.5.1 +
- method for Cache, in §6.4.1 +
- method for CacheStorage, in §6.5.1
- Match Service Worker Registration, in §Unnumbered section
- @@ -5546,51 +5546,51 @@
event for ServiceWorkerGlobalScope, in §4.9
- name to cache map, in §6.1 -
- navigate(url), in §4.2.9 -
- onactivate, in §4.1.4 -
- oncontrollerchange, in §3.4.7 -
- onfetch, in §4.1.4 +
- navigate(url), in §4.2.9 +
- onactivate, in §4.1.4 +
- oncontrollerchange, in §3.4.7 +
- onfetch, in §4.1.4
- onforeignfetch, in §4.1.4 -
- oninstall, in §4.1.4 +
- oninstall, in §4.1.4
- onmessage
-
-- attribute for ServiceWorkerContainer, in §3.4.7 -
- attribute for ServiceWorkerGlobalScope, in §4.1.4 +
- attribute for ServiceWorkerContainer, in §3.4.7 +
- attribute for ServiceWorkerGlobalScope, in §4.1.4
- onstatechange, in §3.1.4 -
- onupdatefound, in §3.2.7 -
- open(cacheName), in §6.5.3 -
- openWindow(url), in §4.3.3 +
- onstatechange, in §3.1.4 +
- onupdatefound, in §3.2.7 +
- open(cacheName), in §6.5.3 +
- openWindow(url), in §4.3.3
- options, in §6.4
- origin
- dfn for service worker client, in §2.3
- dict-member for ServiceWorkerMessageEventInit, in §3.5 -
- attribute for ServiceWorkerMessageEvent, in §3.5.2 +
- attribute for ServiceWorkerMessageEvent, in §3.5.2
- dict-member for ForeignFetchEventInit, in §4.7
- dict-member for ForeignFetchResponse, in §4.7
- dfn for ForeignFetchEvent, in §4.7
- attribute for ForeignFetchEvent, in §4.7.2
- dict-member for ExtendableMessageEventInit, in §4.8 -
- attribute for ExtendableMessageEvent, in §4.8.2 +
- attribute for ExtendableMessageEvent, in §4.8.2
- origins, in §4.5
- ports
-
- dict-member for ServiceWorkerMessageEventInit, in §3.5 -
- attribute for ServiceWorkerMessageEvent, in §3.5.5 +
- attribute for ServiceWorkerMessageEvent, in §3.5.5
- dict-member for ExtendableMessageEventInit, in §4.8 -
- attribute for ExtendableMessageEvent, in §4.8.5 +
- attribute for ExtendableMessageEvent, in §4.8.5
- postMessage(message), in §4.2.4 +
- postMessage(message), in §4.2.4
- postMessage(message, transfer)
-
- method for ServiceWorker, in §3.1.3 -
- method for Client, in §4.2.4 +
- method for ServiceWorker, in §3.1.3 +
- method for Client, in §4.2.4
- potential response @@ -5599,52 +5599,52 @@
dfn for ForeignFetchEvent, in §4.7
- processing equivalence, in §Unnumbered section -
- put(request, response), in §6.4.5 -
- ready, in §3.4.2 -
- ready promise, in §3.4 +
- put(request, response), in §6.4.5 +
- ready, in §3.4.2 +
- ready promise, in §3.4
- "redundant", in §3.1
- redundant, in §3.1
- referrer, in §Unnumbered section
- referrer policy, in §2.1
- registerForeignFetch(options), in §4.5.1
- registering script url, in §2.2 -
- register(scriptURL), in §3.4.3 -
- register(scriptURL, options), in §3.4.3 -
- registration, in §4.1.2 -
- RegistrationOptions, in §3.4 +
- register(scriptURL), in §3.4.3 +
- register(scriptURL, options), in §3.4.3 +
- registration, in §4.1.2 +
- RegistrationOptions, in §3.4
- request
- dict-member for FetchEventInit, in §4.6 -
- attribute for FetchEvent, in §4.6.1 +
- attribute for FetchEvent, in §4.6.1
- dict-member for ForeignFetchEventInit, in §4.7
- attribute for ForeignFetchEvent, in §4.7.1
- dict-member for CacheBatchOperation, in §6.4
- request to response map, in §6.1 -
- reserved, in §4.2.3 +
- reserved, in §4.2.3
- reservedClientId
- dict-member for FetchEventInit, in §4.6 -
- attribute for FetchEvent, in §4.6.3 +
- attribute for FetchEvent, in §4.6.3
- respond-with entered flag
-
- dfn for FetchEvent, in §4.6 -
- dfn for ForeignFetchEvent, in §4.7 +
- dfn for FetchEvent, in §4.6 +
- dfn for ForeignFetchEvent, in §4.7
- respond-with error flag
-
- dfn for FetchEvent, in §4.6 -
- dfn for ForeignFetchEvent, in §4.7 +
- dfn for FetchEvent, in §4.6 +
- dfn for ForeignFetchEvent, in §4.7
- respondWith(r)
-
- method for FetchEvent, in §4.6.6 +
- method for FetchEvent, in §4.6.6
- method for ForeignFetchEvent, in §4.7.3
- @@ -5656,7 +5656,7 @@
attribute for ServiceWorkerRegistration, in §3.2.4 +
- attribute for ServiceWorkerRegistration, in §3.2.4
- dict-member for RegistrationOptions, in §3.4
- attribute for HTMLLinkElement, in §5.2
- element-attr for link, in §5.2 @@ -5677,68 +5677,68 @@
dfn for service worker, in §2.1
- definition of, in §Unnumbered section -
- scriptURL, in §3.1.1 +
- scriptURL, in §3.1.1
- selection, in §2.4 +
- ServiceWorker, in §3.1
- Service-Worker, in §Unnumbered section -
- ServiceWorker, in §3.1
- serviceWorker, in §3.3
- service worker
- dfn for , in §2.1 -
- dfn for ServiceWorkerGlobalScope, in §4.1 +
- dfn for ServiceWorkerGlobalScope, in §4.1
- Service-Worker-Allowed, in §Unnumbered section
- service worker client
-
- dfn for , in §2.3 -
- dfn for ServiceWorkerContainer, in §3.4 -
- dfn for Client, in §4.2 +
- dfn for ServiceWorkerContainer, in §3.4 +
- dfn for Client, in §4.2
- ServiceWorkerContainer, in §3.4 -
- ServiceWorkerGlobalScope, in §4.1 +
- ServiceWorkerContainer, in §3.4 +
- ServiceWorkerGlobalScope, in §4.1
- serviceworker link, in §5
- serviceworker link type, in §5 -
- ServiceWorkerMessageEvent, in §3.5 -
- ServiceWorkerMessageEventInit, in §3.5 +
- ServiceWorkerMessageEvent, in §3.5 +
- ServiceWorkerMessageEventInit, in §3.5
- ServiceWorkerMessageEvent(type), in §3.5
- ServiceWorkerMessageEvent(type, eventInitDict), in §3.5 -
- ServiceWorkerRegistration, in §3.2 +
- ServiceWorkerRegistration, in §3.2
- service worker registration
-
- dfn for , in §2.2 -
- dfn for ServiceWorkerRegistration, in §3.2 +
- dfn for ServiceWorkerRegistration, in §3.2
- ServiceWorkerState, in §3.1.2 +
- ServiceWorkerState, in §3.1
- set of event types to handle, in §2.1
- sharedworker, in §4.3
- "sharedworker", in §4.3
- shared worker client, in §2.3 -
- skipWaiting(), in §4.1.3 +
- skipWaiting(), in §4.1.3
- skip waiting flag, in §2.1
- source
-
- dict-member for ServiceWorkerMessageEventInit, in §3.5 -
- attribute for ServiceWorkerMessageEvent, in §3.5.4 +
- attribute for ServiceWorkerMessageEvent, in §3.5.4
- dict-member for ExtendableMessageEventInit, in §4.8 -
- attribute for ExtendableMessageEvent, in §4.8.4 +
- attribute for ExtendableMessageEvent, in §4.8.4
- startMessages(), in §3.4.6 +
- startMessages(), in §3.4.6
- state
-
- dfn for service worker, in §2.1 -
- attribute for ServiceWorker, in §3.1.2 +
- attribute for ServiceWorker, in §3.1.2
- statechange, in §3.6 +
- statechange, in §3.6
- targetClientId
- dict-member for FetchEventInit, in §4.6 -
- attribute for FetchEvent, in §4.6.4 +
- attribute for FetchEvent, in §4.6.4
- task queues, in §2.2
- @@ -5750,26 +5750,26 @@
dict-member for CacheBatchOperation, in §6.4
- uninstalling flag, in §2.2 -
- unregister(), in §3.2.6 -
- update(), in §3.2.5 +
- unregister(), in §3.2.6 +
- update(), in §3.2.5
- updatefound, in §3.6 -
- url, in §4.2.1 +
- url, in §4.2.1
- using, in §2.4
- visibility state, in §4.2 -
- visibilityState, in §4.2.5 -
- waiting, in §3.2.2 +
- visibilityState, in §4.2.5 +
- waiting, in §3.2.2
- waiting worker, in §2.2
- wait to respond flag
-
-- dfn for FetchEvent, in §4.6 -
- dfn for ForeignFetchEvent, in §4.7 +
- dfn for FetchEvent, in §4.6 +
- dfn for ForeignFetchEvent, in §4.7
- waitUntil(f), in §4.4.1 +
- waitUntil(f), in §4.4.1
- window, in §4.3
- "window", in §4.3
- window client, in §2.3 -
- WindowClient, in §4.2 +
- WindowClient, in §4.2
- worker, in §4.3
- "worker", in §4.3
- worker client, in §2.3 @@ -5851,6 +5851,7 @@
header list (for request)
- header list (for response)
- headers +
- http fetch
- https state
- https state value
- initiator @@ -6113,17 +6114,17 @@
IDL Index
[SecureContext, Exposed=(Window,Worker)] -interface ServiceWorker : EventTarget { - readonly attribute USVString scriptURL; - readonly attribute ServiceWorkerState state; - void postMessage(any message, optional sequence<object> transfer = []); +interface ServiceWorker : EventTarget { + readonly attribute USVString scriptURL; + readonly attribute ServiceWorkerState state; + void postMessage(any message, optional sequence<object> transfer = []); // event - attribute EventHandler onstatechange; + attribute EventHandler onstatechange; }; -ServiceWorker implements AbstractWorker; +ServiceWorker implements AbstractWorker; -enum ServiceWorkerState { +enum ServiceWorkerState { "installing", "installed", "activating", @@ -6132,119 +6133,119 @@@@ -6835,144 +6836,145 @@I }; [SecureContext, Exposed=(Window,Worker)] -interface ServiceWorkerRegistration : EventTarget { - readonly attribute ServiceWorker? installing; - readonly attribute ServiceWorker? waiting; - readonly attribute ServiceWorker? active; +interface ServiceWorkerRegistration : EventTarget { + readonly attribute ServiceWorker? installing; + readonly attribute ServiceWorker? waiting; + readonly attribute ServiceWorker? active; - readonly attribute USVString scope; + readonly attribute USVString scope; - [NewObject] Promise<void> update(); - [NewObject] Promise<boolean> unregister(); + [NewObject] Promise<void> update(); + [NewObject] Promise<boolean> unregister(); // event - attribute EventHandler onupdatefound; + attribute EventHandler onupdatefound; }; partial interface Navigator { - [SecureContext, SameObject] readonly attribute ServiceWorkerContainer serviceWorker; + [SecureContext, SameObject] readonly attribute ServiceWorkerContainer serviceWorker; }; partial interface WorkerNavigator { - [SecureContext, SameObject] readonly attribute ServiceWorkerContainer serviceWorker; + [SecureContext, SameObject] readonly attribute ServiceWorkerContainer serviceWorker; }; [SecureContext, Exposed=(Window,Worker)] -interface ServiceWorkerContainer : EventTarget { - readonly attribute ServiceWorker? controller; - [SameObject] readonly attribute Promise<ServiceWorkerRegistration> ready; +interface ServiceWorkerContainer : EventTarget { + readonly attribute ServiceWorker? controller; + [SameObject] readonly attribute Promise<ServiceWorkerRegistration> ready; - [NewObject] Promise<ServiceWorkerRegistration> register(USVString scriptURL, optional RegistrationOptions options); + [NewObject] Promise<ServiceWorkerRegistration> register(USVString scriptURL, optional RegistrationOptions options); - [NewObject] Promise<any> getRegistration(optional USVString clientURL = ""); - [NewObject] Promise<sequence<ServiceWorkerRegistration>> getRegistrations(); + [NewObject] Promise<any> getRegistration(optional USVString clientURL = ""); + [NewObject] Promise<sequence<ServiceWorkerRegistration>> getRegistrations(); - void startMessages(); + void startMessages(); // events - attribute EventHandler oncontrollerchange; - attribute EventHandler onmessage; // event.source of message events is ServiceWorker object + attribute EventHandler oncontrollerchange; + attribute EventHandler onmessage; // event.source of message events is ServiceWorker object }; -dictionary RegistrationOptions { +dictionary RegistrationOptions { USVString scope; WorkerType type = "classic"; }; -[Constructor(DOMString type, optional ServiceWorkerMessageEventInit eventInitDict), Exposed=(Window,Worker)] -interface ServiceWorkerMessageEvent : Event { - readonly attribute any data; - readonly attribute USVString origin; - readonly attribute DOMString lastEventId; - [SameObject] readonly attribute (ServiceWorker or MessagePort)? source; - readonly attribute FrozenArray<MessagePort> ports; +[Constructor(DOMString type, optional ServiceWorkerMessageEventInit eventInitDict), Exposed=(Window,Worker)] +interface ServiceWorkerMessageEvent : Event { + readonly attribute any data; + readonly attribute USVString origin; + readonly attribute DOMString lastEventId; + [SameObject] readonly attribute (ServiceWorker or MessagePort)? source; + readonly attribute FrozenArray<MessagePort> ports; }; -dictionary ServiceWorkerMessageEventInit : EventInit { +dictionary ServiceWorkerMessageEventInit : EventInit { any data = null; USVString origin = ""; DOMString lastEventId = ""; - (ServiceWorker or MessagePort)? source = null; + (ServiceWorker or MessagePort)? source = null; sequence<MessagePort> ports = []; }; -[Global=(Worker,ServiceWorker), Exposed=ServiceWorker] -interface ServiceWorkerGlobalScope : WorkerGlobalScope { +[Global=(Worker,ServiceWorker), Exposed=ServiceWorker] +interface ServiceWorkerGlobalScope : WorkerGlobalScope { // A container for a list of Client objects that correspond to // browsing contexts (or shared workers) that are on the origin of this SW - [SameObject] readonly attribute Clients clients; - [SameObject] readonly attribute ServiceWorkerRegistration registration; + [SameObject] readonly attribute Clients clients; + [SameObject] readonly attribute ServiceWorkerRegistration registration; - [NewObject] Promise<void> skipWaiting(); + [NewObject] Promise<void> skipWaiting(); - attribute EventHandler oninstall; - attribute EventHandler onactivate; - attribute EventHandler onfetch; + attribute EventHandler oninstall; + attribute EventHandler onactivate; + attribute EventHandler onfetch; attribute EventHandler onforeignfetch; // event - attribute EventHandler onmessage; // event.source of the message events is Client object + attribute EventHandler onmessage; // event.source of the message events is Client object }; [Exposed=ServiceWorker] -interface Client { - readonly attribute USVString url; - readonly attribute DOMString id; - readonly attribute boolean reserved; - void postMessage(any message, optional sequence<object> transfer = []); +interface Client { + readonly attribute USVString url; + readonly attribute DOMString id; + readonly attribute boolean reserved; + void postMessage(any message, optional sequence<object> transfer = []); }; [Exposed=ServiceWorker] -interface WindowClient : Client { - readonly attribute VisibilityState visibilityState; - readonly attribute boolean focused; - [SameObject] readonly attribute FrozenArray<USVString> ancestorOrigins; - [NewObject] Promise<WindowClient> focus(); - [NewObject] Promise<WindowClient> navigate(USVString url); +interface WindowClient : Client { + readonly attribute VisibilityState visibilityState; + readonly attribute boolean focused; + [SameObject] readonly attribute FrozenArray<USVString> ancestorOrigins; + [NewObject] Promise<WindowClient> focus(); + [NewObject] Promise<WindowClient> navigate(USVString url); }; [Exposed=ServiceWorker] -interface Clients { +interface Clients { // The objects returned will be new instances every time - [NewObject] Promise<any> get(DOMString id); - [NewObject] Promise<sequence<Client>> matchAll(optional ClientQueryOptions options); - [NewObject] Promise<WindowClient?> openWindow(USVString url); - [NewObject] Promise<void> claim(); + [NewObject] Promise<any> get(DOMString id); + [NewObject] Promise<sequence<Client>> matchAll(optional ClientQueryOptions options); + [NewObject] Promise<WindowClient?> openWindow(USVString url); + [NewObject] Promise<void> claim(); }; -dictionary ClientQueryOptions { +dictionary ClientQueryOptions { boolean includeUncontrolled = false; boolean includeReserved = false; - ClientType type = "window"; + ClientType type = "window"; }; -enum ClientType { +enum ClientType { "window", "worker", "sharedworker", @@ -6252,8 +6253,8 @@
I }; [Constructor(DOMString type, optional ExtendableEventInit eventInitDict), Exposed=ServiceWorker] -interface ExtendableEvent : Event { - void waitUntil(Promise<any> f); +interface ExtendableEvent : Event { + void waitUntil(Promise<any> f); }; dictionary ExtendableEventInit : EventInit { @@ -6261,27 +6262,27 @@
I }; [Constructor(DOMString type, optional ExtendableEventInit eventInitDict), Exposed=ServiceWorker] -interface InstallEvent : ExtendableEvent { - void registerForeignFetch(ForeignFetchOptions options); +interface InstallEvent : ExtendableEvent { + void registerForeignFetch(ForeignFetchOptions options); }; -dictionary ForeignFetchOptions { +dictionary ForeignFetchOptions { required sequence<USVString> scopes; required sequence<USVString> origins; }; -[Constructor(DOMString type, FetchEventInit eventInitDict), Exposed=ServiceWorker] -interface FetchEvent : ExtendableEvent { - [SameObject] readonly attribute Request request; - readonly attribute DOMString clientId; - readonly attribute DOMString reservedClientId; - readonly attribute DOMString targetClientId; - readonly attribute boolean isReload; +[Constructor(DOMString type, FetchEventInit eventInitDict), Exposed=ServiceWorker] +interface FetchEvent : ExtendableEvent { + [SameObject] readonly attribute Request request; + readonly attribute DOMString clientId; + readonly attribute DOMString reservedClientId; + readonly attribute DOMString targetClientId; + readonly attribute boolean isReload; - void respondWith(Promise<Response> r); + void respondWith(Promise<Response> r); }; -dictionary FetchEventInit : ExtendableEventInit { +dictionary FetchEventInit : ExtendableEventInit { required Request request; DOMString clientId = ""; DOMString reservedClientId = ""; @@ -6289,39 +6290,39 @@
I boolean isReload = false; }; -[Constructor(DOMString type, ForeignFetchEventInit eventInitDict), Exposed=ServiceWorker] -interface ForeignFetchEvent : ExtendableEvent { +[Constructor(DOMString type, ForeignFetchEventInit eventInitDict), Exposed=ServiceWorker] +interface ForeignFetchEvent : ExtendableEvent { [SameObject] readonly attribute Request request; readonly attribute USVString origin; - void respondWith(Promise<ForeignFetchResponse> r); + void respondWith(Promise<ForeignFetchResponse> r); }; -dictionary ForeignFetchEventInit : ExtendableEventInit { +dictionary ForeignFetchEventInit : ExtendableEventInit { required Request request; USVString origin = "null"; }; -dictionary ForeignFetchResponse { +dictionary ForeignFetchResponse { required Response response; USVString origin; sequence<ByteString> headers; }; -[Constructor(DOMString type, optional ExtendableMessageEventInit eventInitDict), Exposed=ServiceWorker] -interface ExtendableMessageEvent : ExtendableEvent { - readonly attribute any data; - readonly attribute USVString origin; - readonly attribute DOMString lastEventId; - [SameObject] readonly attribute (Client or ServiceWorker or MessagePort)? source; - readonly attribute FrozenArray<MessagePort> ports; +[Constructor(DOMString type, optional ExtendableMessageEventInit eventInitDict), Exposed=ServiceWorker] +interface ExtendableMessageEvent : ExtendableEvent { + readonly attribute any data; + readonly attribute USVString origin; + readonly attribute DOMString lastEventId; + [SameObject] readonly attribute (Client or ServiceWorker or MessagePort)? source; + readonly attribute FrozenArray<MessagePort> ports; }; -dictionary ExtendableMessageEventInit : ExtendableEventInit { +dictionary ExtendableMessageEventInit : ExtendableEventInit { any data = null; USVString origin = ""; DOMString lastEventId = ""; - (Client or ServiceWorker or MessagePort)? source = null; + (Client or ServiceWorker or MessagePort)? source = null; sequence<MessagePort> ports = []; }; @@ -6331,41 +6332,41 @@
I }; partial interface WindowOrWorkerGlobalScope { - [SecureContext, SameObject] readonly attribute CacheStorage caches; + [SecureContext, SameObject] readonly attribute CacheStorage caches; }; [SecureContext, Exposed=(Window,Worker)] -interface Cache { - [NewObject] Promise<any> match(RequestInfo request, optional CacheQueryOptions options); - [NewObject] Promise<sequence<Response>> matchAll(optional RequestInfo request, optional CacheQueryOptions options); - [NewObject] Promise<void> add(RequestInfo request); - [NewObject] Promise<void> addAll(sequence<RequestInfo> requests); - [NewObject] Promise<void> put(RequestInfo request, Response response); - [NewObject] Promise<boolean> delete(RequestInfo request, optional CacheQueryOptions options); - [NewObject] Promise<sequence<Request>> keys(optional RequestInfo request, optional CacheQueryOptions options); +interface Cache { + [NewObject] Promise<any> match(RequestInfo request, optional CacheQueryOptions options); + [NewObject] Promise<sequence<Response>> matchAll(optional RequestInfo request, optional CacheQueryOptions options); + [NewObject] Promise<void> add(RequestInfo request); + [NewObject] Promise<void> addAll(sequence<RequestInfo> requests); + [NewObject] Promise<void> put(RequestInfo request, Response response); + [NewObject] Promise<boolean> delete(RequestInfo request, optional CacheQueryOptions options); + [NewObject] Promise<sequence<Request>> keys(optional RequestInfo request, optional CacheQueryOptions options); }; -dictionary CacheQueryOptions { +dictionary CacheQueryOptions { boolean ignoreSearch = false; boolean ignoreMethod = false; boolean ignoreVary = false; DOMString cacheName; }; -dictionary CacheBatchOperation { +dictionary CacheBatchOperation { DOMString type; Request request; Response response; - CacheQueryOptions options; + CacheQueryOptions options; }; [SecureContext, Exposed=(Window,Worker)] -interface CacheStorage { - [NewObject] Promise<any> match(RequestInfo request, optional CacheQueryOptions options); - [NewObject] Promise<boolean> has(DOMString cacheName); - [NewObject] Promise<Cache> open(DOMString cacheName); - [NewObject] Promise<boolean> delete(DOMString cacheName); - [NewObject] Promise<sequence<DOMString>> keys(); +interface CacheStorage { + [NewObject] Promise<any> match(RequestInfo request, optional CacheQueryOptions options); + [NewObject] Promise<boolean> has(DOMString cacheName); + [NewObject] Promise<Cache> open(DOMString cacheName); + [NewObject] Promise<boolean> delete(DOMString cacheName); + [NewObject] Promise<sequence<DOMString>> keys(); };
Handle Functional Event -