summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/browsers/windows/auxiliary-browsing-contexts/opener-setter.html
blob: ac6e47b846b4980c522cb8c3c9ef16b5b53ea9a3 (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
<!doctype html>
<html>
  <head>
    <title>Auxiliary Browsing Contexts: window.opener setter</title>
    <meta name=timeout content=long>
    <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());
      prefixedLocalStorage.onSet('openerIsNull', t.step_func_done(e => {
        assert_equals(e.newValue, 'true');
      }));
      window.open(prefixedLocalStorage.url('resources/opener-setter.html'),
        'iShouldSetOpenerToNull');
    }, 'Auxiliary browsing context created via `window.open` and setting `window.opener` to `null` should report `window.opener` `null`');
    async_test(t => {
      t.add_cleanup(() => prefixedLocalStorage.cleanup());
      prefixedLocalStorage.onSet('openerIsTest', t.step_func_done(e => {
        assert_equals(e.newValue, 'true');
      }));
      window.open(prefixedLocalStorage.url('resources/opener-setter.html'),
        'iShouldSetOpenerToTest');
    }, 'Auxiliary browsing context created via `window.open` and setting `window.opener` to `test` should report `test`');
    </script>
  </body>
</html>