summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/user-activation/resources/child-message-event-api.html
blob: a0001633c22d19e44c1f48ddeffa07dde1fbc436 (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
<!DOCTYPE html>
<body style="background: red;">
  <script>
    window.parent.postMessage("child-loaded",
                              {targetOrigin: "*", includeUserActivation: true});
    window.addEventListener("click", event => {
      window.parent.postMessage("child-clicked",
                                {targetOrigin: "*", includeUserActivation: true});
      var win = window.open('404.html');
      win.close();
    });

    window.addEventListener("message", event => {
      if (event.data == "report") {
        window.parent.postMessage("child-report",
                                  {targetOrigin: "*", includeUserActivation: true});
      }
      if (event.data == "report-no-activation") {
        window.parent.postMessage("child-report-no-activation",
                                  {targetOrigin: "*", includeUserActivation: false});
      }
    });
  </script>
</body>