summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/user-activation/resources/child-one.html
blob: 966837262069acbb1a414c1b4d631b457979fea4 (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>
<body style="background: yellow;">
  <script>
    window.top.postMessage(JSON.stringify({
        "type": "child-one-loaded",
        "isActive": navigator.userActivation.isActive,
        "hasBeenActive": navigator.userActivation.hasBeenActive
    }), "*");

    window.addEventListener("click", event => {
        window.top.postMessage(JSON.stringify({
            "type": "child-one-clicked",
            "isActive": navigator.userActivation.isActive,
            "hasBeenActive": navigator.userActivation.hasBeenActive
        }), "*");
    });

    window.addEventListener("message", event => {
        var msg = JSON.parse(event.data);
        if (msg.type == "report") {
            window.top.postMessage(JSON.stringify({
                "type": "child-one-report",
                "isActive": navigator.userActivation.isActive,
                "hasBeenActive": navigator.userActivation.hasBeenActive
            }), "*");
        }
    });
  </script>
</body>