summaryrefslogtreecommitdiffstats
path: root/browser/components/originattributes/test/browser/file_postMessage.html
blob: 91255d03648a641c05f4c56591aea88aefe27584 (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
<!DOCTYPE HTML>
<html>
<head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <title>Test page for window.postMessage</title>
</head>
<body>
  <div id="display" style="white-space:pre; font-family:monospace; display:inline;"></div>
  <input type="button" id="button" title="button"/>
  <script>

  const TEST_PATH = "http://example.org/browser/browser/components/originattributes/test/browser/file_postMessageSender.html";

  window.onload = () => {
    window.addEventListener("message", aEvent => {
      if (aEvent.data === "Message") {
        document.getElementById("display").innerHTML = "Message";
      }
    });

    document.getElementById("button").onclick = () => {
      window.postMessage("Self", "/");
    };
  };
  </script>
</body>
</html>