summaryrefslogtreecommitdiffstats
path: root/browser/components/originattributes/test/browser/test_firstParty_postMessage.html
blob: a056909e37a26fc965222582619221a4c033d45f (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
<!DOCTYPE HTML>
<html>
<head>
  <meta charset="utf-8"/>
  <title>Test for Bug 1260931</title>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<script>
function onload() {
  let iframe1 = document.getElementById("iframe1");
  iframe1.contentWindow.postMessage("HI", "https://example.net");
}

window.onmessage = function(evt) {
  document.getElementById("message").textContent = evt.data;

  let iframe2 = document.createElement("iframe");
  iframe2.src = "dummy.html";
  document.body.appendChild(iframe2);
};
</script>
<body onload="onload()">
  <div>
    <iframe id="iframe1" src="test.html"></iframe>
    <span id="message"></span>
  </div>
</body>
</html>