summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/user-activation/resources/consumption-sameorigin-child.html
blob: 9e421fc0f1ed098a500c9c64be7cd892dce3d2be (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
<!DOCTYPE html>
<html>
<head>
  <script>
    window.top.postMessage(JSON.stringify({
        "type": "child-sameorigin-loaded",
        "isActive": navigator.userActivation.isActive,
        "hasBeenActive": navigator.userActivation.hasBeenActive
    }), "*");

    window.addEventListener("click", event => {
        window.open().close();

        window.top.postMessage(JSON.stringify({
            "type": "child-sameorigin-report",
            "isActive": navigator.userActivation.isActive,
            "hasBeenActive": navigator.userActivation.hasBeenActive
        }), "*");
    });
  </script>
</head>
<body style="background: lightgreen;">
  <!-- The midpoint of this frame should be outside the grandchild frame. -->
  <div style="height: 75px;">Same-origin child frame</div>
  <iframe id="child2" width="270px" height="30px"
          src="child-two.html">
  </iframe>
</body>
</html>