aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/webidls
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom/webidls')
-rw-r--r--components/script/dom/webidls/Client.webidl21
-rw-r--r--components/script/dom/webidls/Navigator.webidl5
-rw-r--r--components/script/dom/webidls/ServiceWorker.webidl25
-rw-r--r--components/script/dom/webidls/ServiceWorkerContainer.webidl27
-rw-r--r--components/script/dom/webidls/ServiceWorkerGlobalScope.webidl23
-rw-r--r--components/script/dom/webidls/ServiceWorkerRegistration.webidl20
6 files changed, 121 insertions, 0 deletions
diff --git a/components/script/dom/webidls/Client.webidl b/components/script/dom/webidls/Client.webidl
new file mode 100644
index 00000000000..b74218aa787
--- /dev/null
+++ b/components/script/dom/webidls/Client.webidl
@@ -0,0 +1,21 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+// https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#client
+
+// [Exposed=ServiceWorker]
+[Pref="dom.serviceworker.enabled"]
+interface Client {
+ readonly attribute USVString url;
+ readonly attribute FrameType frameType;
+ readonly attribute DOMString id;
+ //void postMessage(any message, optional sequence<Transferable> transfer);
+};
+
+enum FrameType {
+ "auxiliary",
+ "top-level",
+ "nested",
+ "none"
+};
diff --git a/components/script/dom/webidls/Navigator.webidl b/components/script/dom/webidls/Navigator.webidl
index 4d9ead9f7f9..ca9b4a36a4a 100644
--- a/components/script/dom/webidls/Navigator.webidl
+++ b/components/script/dom/webidls/Navigator.webidl
@@ -31,6 +31,11 @@ interface NavigatorBluetooth {
readonly attribute Bluetooth bluetooth;
};
+// https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#navigator-service-worker
+partial interface Navigator {
+ [SameObject, Pref="dom.serviceworker.enabled"] readonly attribute ServiceWorkerContainer serviceWorker;
+};
+
// https://html.spec.whatwg.org/multipage/#navigatorlanguage
[NoInterfaceObject/*, Exposed=Window,Worker*/]
interface NavigatorLanguage {
diff --git a/components/script/dom/webidls/ServiceWorker.webidl b/components/script/dom/webidls/ServiceWorker.webidl
new file mode 100644
index 00000000000..4718b164ce0
--- /dev/null
+++ b/components/script/dom/webidls/ServiceWorker.webidl
@@ -0,0 +1,25 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+// http://slightlyoff.github.io/ServiceWorker/spec/service_worker/#service-worker-obj
+//[Exposed=(Window,Worker)]
+[Pref="dom.serviceworker.enabled"]
+interface ServiceWorker : EventTarget {
+ readonly attribute USVString scriptURL;
+ readonly attribute ServiceWorkerState state;
+ //[Throws] void postMessage(any message/*, optional sequence<Transferable> transfer*/);
+
+ // event
+ attribute EventHandler onstatechange;
+};
+
+ServiceWorker implements AbstractWorker;
+
+enum ServiceWorkerState {
+ "installing",
+ "installed",
+ "activating",
+ "activated",
+ "redundant"
+};
diff --git a/components/script/dom/webidls/ServiceWorkerContainer.webidl b/components/script/dom/webidls/ServiceWorkerContainer.webidl
new file mode 100644
index 00000000000..3c28bb8994d
--- /dev/null
+++ b/components/script/dom/webidls/ServiceWorkerContainer.webidl
@@ -0,0 +1,27 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+// https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#service-worker-container
+// [Exposed=(Window,Worker)]
+[Pref="dom.serviceworker.enabled"]
+interface ServiceWorkerContainer : EventTarget {
+ [Unforgeable] readonly attribute ServiceWorker? controller;
+ //[SameObject] readonly attribute Promise<ServiceWorkerRegistration> ready;
+
+ [NewObject, Throws] ServiceWorkerRegistration register(USVString scriptURL, optional RegistrationOptions options);
+
+ //[NewObject] /*Promise<any>*/ any getRegistration(optional USVString clientURL = "");
+ //[NewObject] /* Promise */<sequence<ServiceWorkerRegistration>> getRegistrations();
+
+
+ // events
+ //attribute EventHandler oncontrollerchange;
+ //attribute EventHandler onerror;
+ //attribute EventHandler onmessage; // event.source of message events is ServiceWorker object
+};
+
+dictionary RegistrationOptions {
+ USVString scope;
+ //WorkerType type = "classic";
+};
diff --git a/components/script/dom/webidls/ServiceWorkerGlobalScope.webidl b/components/script/dom/webidls/ServiceWorkerGlobalScope.webidl
new file mode 100644
index 00000000000..0b630fb3b1e
--- /dev/null
+++ b/components/script/dom/webidls/ServiceWorkerGlobalScope.webidl
@@ -0,0 +1,23 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+// https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#service-worker-global-scope
+
+[Global, Pref="dom.serviceworker.enabled"/*=(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;
+
+ //[NewObject] Promise<void> skipWaiting();
+
+ //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
+};
diff --git a/components/script/dom/webidls/ServiceWorkerRegistration.webidl b/components/script/dom/webidls/ServiceWorkerRegistration.webidl
new file mode 100644
index 00000000000..c6c36f22475
--- /dev/null
+++ b/components/script/dom/webidls/ServiceWorkerRegistration.webidl
@@ -0,0 +1,20 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+// https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#service-worker-registration-obj
+//[Exposed=(Window,Worker)]
+[Pref="dom.serviceworker.enabled"]
+interface ServiceWorkerRegistration : EventTarget {
+ [Unforgeable] readonly attribute ServiceWorker? installing;
+ [Unforgeable] readonly attribute ServiceWorker? waiting;
+ [Unforgeable] readonly attribute ServiceWorker? active;
+
+ readonly attribute USVString scope;
+
+ // [NewObject] Promise<void> update();
+ // [NewObject] Promise<boolean> unregister();
+
+ // event
+ // attribute EventHandler onupdatefound;
+};