summaryrefslogtreecommitdiffstats
path: root/devtools/client/aboutdebugging/test/service-workers/push-sw.html
diff options
context:
space:
mode:
Diffstat (limited to 'devtools/client/aboutdebugging/test/service-workers/push-sw.html')
-rw-r--r--devtools/client/aboutdebugging/test/service-workers/push-sw.html32
1 files changed, 32 insertions, 0 deletions
diff --git a/devtools/client/aboutdebugging/test/service-workers/push-sw.html b/devtools/client/aboutdebugging/test/service-workers/push-sw.html
new file mode 100644
index 000000000..7db01f091
--- /dev/null
+++ b/devtools/client/aboutdebugging/test/service-workers/push-sw.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title>Service worker push test</title>
+</head>
+<body>
+<script type="text/javascript">
+"use strict";
+SpecialPowers.addPermission("desktop-notification", true, document);
+var sw = navigator.serviceWorker.register("push-sw.js");
+var sub = null;
+sw.then(
+ function (registration) {
+ dump("SW registered\n");
+ registration.pushManager.subscribe().then(
+ function (subscription) {
+ sub = subscription;
+ dump("SW subscribed to push: " + sub.endpoint + "\n");
+ },
+ function (error) {
+ dump("SW not subscribed to push: " + error + "\n");
+ }
+ );
+ },
+ function (error) {
+ dump("SW not registered: " + error + "\n");
+ }
+);
+</script>
+</body>
+</html>