summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/browsers/windows/auxiliary-browsing-contexts/opener-multiple.html
blob: e71d4dc8687b80e5c987349c58d46c8e0c2f3172 (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
30
31
32
33
34
35
<!doctype html>
<html>
  <head>
    <title>Auxiliary Browsing Contexts: window.opener, multiple</title>
    <script src="/resources/testharness.js"></script>
    <script src="/resources/testharnessreport.js"></script>
    <script src="/common/PrefixedLocalStorage.js"></script>
  </head>
  <body>
    <div id="log"></div>
    <script>
    var prefixedLocalStorage;
    setup (() => prefixedLocalStorage = new PrefixedLocalStorageTest());
    async_test(t => {
      t.add_cleanup (() => prefixedLocalStorage.cleanup());
      var a       = document.createElement('a');
      a.href      = prefixedLocalStorage.url('resources/multiple-opener.html');
      a.target    = 'multipleOpener';
      window.name = 'topOpener';
      document.body.appendChild(a);
      window.addEventListener('message', t.step_func_done(e => {
        var aux1 = e.data.aux1; // First opened context
        var aux2 = e.data.aux2; // Context opened by first-opened context
        assert_equals(aux1.name, 'multipleOpener');
        assert_equals(aux1.openerName, window.name);
        assert_equals(aux1.isTop, true);
        assert_equals(aux2.name, 'multipleOpenee');
        assert_equals(aux2.openerName, aux1.name);
        assert_equals(aux2.isTop, true);
      }));
      a.click();
    }, 'An auxiliary browsing context should be able to open another auxiliary browsing context');
    </script>
  </body>
</html>