summaryrefslogtreecommitdiffstats
path: root/dom/serviceworkers/test/service_worker.js
diff options
context:
space:
mode:
Diffstat (limited to 'dom/serviceworkers/test/service_worker.js')
-rw-r--r--dom/serviceworkers/test/service_worker.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/dom/serviceworkers/test/service_worker.js b/dom/serviceworkers/test/service_worker.js
new file mode 100644
index 0000000000..90cb97ef82
--- /dev/null
+++ b/dom/serviceworkers/test/service_worker.js
@@ -0,0 +1,9 @@
+onmessage = function (e) {
+ self.clients.matchAll().then(function (res) {
+ if (!res.length) {
+ dump("Error: no clients are currently controlled.\n");
+ return;
+ }
+ res[0].postMessage(indexedDB ? { available: true } : { available: false });
+ });
+};