summaryrefslogtreecommitdiffstats
path: root/devtools/client/aboutdebugging/test/browser/resources/service-workers/fetch-sw.html
blob: a1bb218341cb59c3df4821e8c270ccceccb2b42d (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
<!DOCTYPE HTML>
<html>
<head>
  <meta charset="UTF-8">
  <title>Service worker test</title>
</head>
<body>
<script type="text/javascript">
"use strict";

let registration;

const registerServiceWorker = async function() {
  try {
    registration = await navigator.serviceWorker.register("fetch-sw.js");
    dump("Empty service worker registered\n");
  } catch (e) {
    dump("Empty service worker not registered: " + e + "\n");
  }
};

// Helper called from helper-serviceworker.js to unregister the service worker.
window.getRegistration = function() {
  return registration;
};
// Register the service worker.
registerServiceWorker();
</script>
</body>
</html>