summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_allow_top_navigation_by_user_activation-manual.html
blob: 0fa9de7c125c3de5599edcddf2692f1f54356c32 (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
<html>
<head>
    <style>
        iframe { width: 400px; height: 300px;}
    </style>
    <script src="/resources/testharness.js"></script>
    <script src="/resources/testharnessreport.js"></script>
    <script>
      setup({explicit_timeout: true});

      async_test(function(t) {
        window.addEventListener("message", t.step_func_done(function(e) {
            assert_equals(e.data, "BLOCKED", "The message should say 'BLOCKED'.");
          }));
      }, "The sandboxed iframe should post a message saying the top navigation was blocked when no user gesture.");
    </script>
</head>
<body>
    <p>This tests that an iframe in sandbox with 'allow-top-navigation-by-user-activation'
    can navigate the top level page, if it is trigged by a user gesture.</p>
    <p>Click on the button in the iframe and it should navigate the top page.</p>
    <iframe id="i" sandbox="allow-scripts allow-top-navigation-by-user-activation" src="support/iframe-that-performs-top-navigation.html"></iframe>
</body>
</html>