3 <title>Service Workers: ServiceWorkerGlobalScope
</title>
5 <link rel=
"help" href=
"https://w3c.github.io/ServiceWorker/#service-worker-global-scope">
6 <script src=
"/resources/testharness.js"></script>
7 <script src=
"/resources/testharnessreport.js"></script>
9 <script src=/resources/WebIDLParser.js
></script>
10 <script src=/resources/idlharness.js
></script>
15 <script type=text/plain
id=
"idl_0">
17 interface ServiceWorkerGlobalScope : WorkerGlobalScope {
18 readonly attribute CacheStorage caches;
19 // A container for a list of window objects, identifiable by ID, that
20 // correspond to windows (or workers) that are
"controlled" by this SW
21 readonly attribute ServiceWorkerClients clients;
22 [Unforgeable] readonly attribute DOMString scope;
24 Promise
<any> fetch((Request or ScalarValueString) request);
29 attribute EventHandler oninstall;
30 attribute EventHandler onactivate;
31 attribute EventHandler onfetch;
32 attribute EventHandler onbeforeevicted;
33 attribute EventHandler onevicted;
35 // The event.source of these MessageEvents are instances of Client
36 attribute EventHandler onmessage;
38 // close() method inherited from WorkerGlobalScope is not exposed.
43 The `ServiceWorkerGlobalScope` interface represents the global execution
44 context of a Service Worker. `ServiceWorkerGlobalScope` object provides
45 generic, event-driven, time-limited script execution contexts that run at an
46 origin. Once successfully [registered][1], a Service Worker is started, kept
47 alive and killed by their relationship to events, not documents. Any type of
48 synchronous requests MUST NOT be initiated inside of a Service Worker.
50 [1]: #navigator-service-worker-register
54 <script type=text/plain
id=
"untested_idls">
55 interface CacheStorage {};
56 interface ServiceWorkerClients {};
58 interface ScalarValueString {};
59 interface EventHandler {};
60 interface WorkerGlobalScope {};
64 var idl_array
= new IdlArray();
65 idl_array
.add_untested_idls(document
.getElementById("untested_idls").textContent
);
66 idl_array
.add_idls(document
.getElementById("idl_0").textContent
);
67 idl_array
.add_objects({
68 ServiceWorkerGlobalScope
: ["throw new Error ('No object defined for the ServiceWorkerGlobalScope interface')"]