summaryrefslogtreecommitdiffstats
path: root/toolkit/components/antitracking/test/browser/partitionedSharedWorker.js
blob: 5ac4ec9f27c1ceb59af4d67b9ea8711dc24d5116 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
let value = "";
self.onconnect = e => {
  e.ports[0].onmessage = event => {
    if (event.data.what === "get") {
      e.ports[0].postMessage(value);
      return;
    }

    if (event.data.what === "put") {
      value = event.data.value;
      return;
    }

    // Error.
    e.ports[0].postMessage(-1);
  };
};