summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_allow_top_navigation-3.html
blob: c3e5dc1fd6a0c5786dfeed57699bbf37901fa08e (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>Check that sandboxed iframe can perform navigation on the top frame
           when allow-top-navigation is set (even when
           allow-top-navigation-by-user-activation is set)</title>
    <script src="/resources/testharness.js"></script>
    <script src="/resources/testharnessreport.js"></script>
  </head>
  <body>
    <script>
      // We are the main test page.  Open a popup, so that we can
      // can experiment navigation of the top frame.
      async_test(t => {
        window.addEventListener("message", t.step_func_done(e => {
          assert_equals(e.data, "can navigate");
          e.source.close();
        }));
        // Specifying both allow-top-navigation and
        // allow-top-navigation-by-user-activation is a document conformance
        // error: allow-top-navigation-by-user-activation will have no effect.
        let sandbox = "allow-top-navigation allow-top-navigation-by-user-activation allow-scripts";
        window.open("support/load-into-the-iframe.html?sandbox=" + sandbox);
      }, "Frames with `allow-top-navigation` should be able to navigate the top frame even when `allow-top-navigation-by-user-activation` is set.");
    </script>
  </body>
</html>