Implement the "noopener" feature for window.open()
[WebKit-https.git] / LayoutTests / imported / w3c / web-platform-tests / html / browsers / windows / auxiliary-browsing-contexts / opener-closed.html
1 <!doctype html>
2 <meta charset="utf-8">
3 <html>
4   <head>
5     <title>Auxiliary Browing Contexts: window.opener when Opener Removed/Closed</title>
6     <script src="../../../../../../../resources/testharness.js"></script>
7     <script src="../../../../../../../resources/testharnessreport.js"></script>
8     <script src="/common/PrefixedLocalStorage.js"></script>
9   </head>
10   <body>
11     <div id="log"></div>
12     <script>
13     var prefixedLocalStorage;
14     setup (() => prefixedLocalStorage = new PrefixedLocalStorageTest());
15     async_test(t => {
16       t.add_cleanup (() => prefixedLocalStorage.cleanup());
17       var a       = document.createElement('a');
18       a.href      = prefixedLocalStorage.url('resources/open-closer.html');
19       a.target    = '_blank';
20       prefixedLocalStorage.onSet('openerIsNull', t.step_func_done(e => {
21         // The window for this auxiliary browsing context's opener
22         // has been closed and discarded, so the aux browsing context
23         // should now report `null` for `window.opener`
24         assert_equals(e.newValue, 'true');
25       }));
26       document.body.append(a);
27       a.click();
28     }, 'An auxiliary browsing context should report `null` for `window.opener` when that browsing context is discarded');
29     </script>
30   </body>
31 </html>