summaryrefslogtreecommitdiffstats
path: root/dom/serviceworkers/test/fetch/cookie/register.html
blob: 99eabaf0a2af2ffdd90520bc748ad513d25362ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<!DOCTYPE html>
<script src="../../utils.js"></script>
<script>
  function ok(v, msg) {
    window.parent.postMessage({status: "ok", result: !!v, message: msg}, "*");
  }

  function done(reg) {
    ok(reg.active, "The active worker should be available.");
    window.parent.postMessage({status: "registrationdone"}, "*");
  }

  document.cookie = "foo=bar";

  navigator.serviceWorker.register("cookie_test.js", {scope: "."})
                         .then(reg => {
                           return waitForState(reg.installing, "activated", reg);
                         }).then(done);
</script>