summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/anonymous-iframe/resources/serviceworker-partitioning-helper.js
blob: 288ad5954e2d51c17c1088dac428927f63321bbf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
let messages = {};
let ports = {};

self.addEventListener("message", e => {
  const from = e.data.from;
  const check = e.data.check;

  if (from) {
    messages[from] = true;
    ports[from] = e.ports[0];
  }

  if (check) {
    ports[check].postMessage(messages);
  }
});