summaryrefslogtreecommitdiffstats
path: root/dom/serviceworkers/test/thirdparty/unregister.html
blob: 65b29d56481ab8122c856b8100c03dbab3510d13 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<!DOCTYPE html>
<script>
  if (navigator.serviceWorker.controller) {
    window.parent.postMessage({status: "controlled"}, "*");
  } else {
    window.parent.postMessage({status: "uncontrolled"}, "*");
  }

  navigator.serviceWorker.getRegistration(".").then(function(registration) {
    if(!registration) {
      return;
    }
    registration.unregister().then(() => {
      window.parent.postMessage({status: "unregistrationdone"}, "*");
    });
  }).catch(function(e) {
    window.parent.postMessage({status: "getregistrationfailed"}, "*");
  });
</script>