summaryrefslogtreecommitdiffstats
path: root/devtools/shared/webconsole/test/chrome/helper_serviceworker.js
blob: 5f0f5208194a7decefde2a1a49c6d1640743da5b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
"use strict";

console.log("script evaluation");

addEventListener("install", function(evt) {
  console.log("install event");
});

addEventListener("activate", function(evt) {
  console.log("activate event");
});

addEventListener("fetch", function(evt) {
  console.log("fetch event: " + evt.request.url);
  evt.respondWith(new Response("Hello world"));
});

addEventListener("message", function(evt) {
  console.log("message event: " + evt.data.message);
  evt.source.postMessage({ type: "PONG" });
});