summaryrefslogtreecommitdiffstats
path: root/toolkit/components/antitracking/test/browser/3rdPartyRelay.html
blob: 64e713913b3b5decfd50a524898305535cf45979 (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
31
32
33
34
35
36
37
38
39
40
41
<html>
<head>
  <title>Tracker</title>
  <script type="text/javascript" src="https://example.com/browser/toolkit/components/antitracking/test/browser/storageAccessAPIHelpers.js"></script>
</head>
<body>
<h1>Relay</h1>
<iframe></iframe>
<script>

function info(msg) {
  parent.postMessage({ type: "info", msg }, "*");
}

function ok(what, msg) {
  parent.postMessage({ type: "ok", what: !!what, msg }, "*");
}

function is(a, b, msg) {
  ok(a === b, msg);
}

onmessage = function(e) {
  switch (e.data.type || "") {
    case "finish":
    case "ok":
    case "info":
      parent.postMessage(e.data, "*");
      break;
    default:
      let iframe = document.querySelector("iframe");
      iframe.contentWindow.postMessage(e.data, "*");
      break;
  }
};

document.querySelector("iframe").src = location.search.substr(1);

</script>
</body>
</html>