targeting-cross-origin-nested-browsing-contexts.html (1213B)
1 <!doctype html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>Targeting nested browsing contexts</title> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 </head> 9 <body> 10 <script src="/common/get-host-info.sub.js"></script> 11 <script> 12 async_test(function (t) { 13 var windowsToClose = []; 14 window.onmessage = t.step_func(function (e) { 15 if (e.data.name == "openee") { 16 var a = document.body.appendChild(document.createElement('a')); 17 a.target = "nested1"; 18 a.href = "resources/post-to-opener.html"; 19 a.click(); 20 windowsToClose.push(e.source); 21 } else { 22 assert_equals(e.data.name, "nested1"); 23 assert_equals(e.data.isTop, true); 24 windowsToClose.push(e.source); 25 windowsToClose.forEach(function (w) { 26 w.close(); 27 }); 28 t.done(); 29 } 30 }); 31 32 var a = document.body.appendChild(document.createElement('a')); 33 a.target = "openee"; 34 a.href = get_host_info().HTTP_REMOTE_ORIGIN + "/html/browsers/windows/resources/nested-post-to-opener.html"; 35 a.click(); 36 }); 37 </script> 38 </body> 39 </html>