summaryrefslogtreecommitdiffstats
path: root/dom/workers/test/serviceworkers/notification
diff options
context:
space:
mode:
Diffstat (limited to 'dom/workers/test/serviceworkers/notification')
-rw-r--r--dom/workers/test/serviceworkers/notification/listener.html27
-rw-r--r--dom/workers/test/serviceworkers/notification/register.html11
-rw-r--r--dom/workers/test/serviceworkers/notification/unregister.html12
3 files changed, 50 insertions, 0 deletions
diff --git a/dom/workers/test/serviceworkers/notification/listener.html b/dom/workers/test/serviceworkers/notification/listener.html
new file mode 100644
index 000000000..1c6e282ec
--- /dev/null
+++ b/dom/workers/test/serviceworkers/notification/listener.html
@@ -0,0 +1,27 @@
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Bug 1114554 - proxy to forward messages from SW to test</title>
+<script class="testbody" type="text/javascript">
+ var testWindow = parent;
+ if (opener) {
+ testWindow = opener;
+ }
+
+ navigator.serviceWorker.onmessage = function(msg) {
+ // worker message;
+ testWindow.postMessage(msg.data, "*");
+ if (msg.data.type == 'finish') {
+ window.close();
+ }
+ };
+</script>
+
+</head>
+<body>
+</body>
+</html>
diff --git a/dom/workers/test/serviceworkers/notification/register.html b/dom/workers/test/serviceworkers/notification/register.html
new file mode 100644
index 000000000..b7df73bed
--- /dev/null
+++ b/dom/workers/test/serviceworkers/notification/register.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<script>
+ function done() {
+ parent.callback();
+ }
+
+ navigator.serviceWorker.ready.then(done);
+ navigator.serviceWorker.register("../notification_get_sw.js", {scope: "."}).catch(function(e) {
+ dump("Registration failure " + e.message + "\n");
+ });
+</script>
diff --git a/dom/workers/test/serviceworkers/notification/unregister.html b/dom/workers/test/serviceworkers/notification/unregister.html
new file mode 100644
index 000000000..d5a141f83
--- /dev/null
+++ b/dom/workers/test/serviceworkers/notification/unregister.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<script>
+ navigator.serviceWorker.getRegistration(".").then(function(registration) {
+ registration.unregister().then(function(success) {
+ if (success) {
+ window.parent.callback();
+ }
+ }, function(e) {
+ dump("Unregistering the SW failed with " + e + "\n");
+ });
+ });
+</script>