blob: 7db01f09149a0d6940ff136a13feb70a15897ebc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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>
|