element-ready-check-fullscreen-iframe-child.html (1442B)
1 <!DOCTYPE html> 2 <title>Element ready check for child of a fullscreen iframe</title> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <script src="/resources/testdriver.js"></script> 6 <script src="/resources/testdriver-vendor.js"></script> 7 <script src="../trusted-click.js"></script> 8 <div id="log"></div> 9 <iframe><!-- script inserts div here --></iframe> 10 <script> 11 // Verify that an iframe can itself go fullscreen, and that this doesn't 12 // influence the iframe ancestor test of the element ready check. 13 promise_test(async (t) => { 14 document.onfullscreenerror = t.unreached_func("fullscreenerror event"); 15 const iframe = document.querySelector("iframe"); 16 await Promise.all([trusted_request(iframe), fullScreenChange()]); 17 18 assert_equals(document.fullscreenElement, iframe, "fullscreen element"); 19 20 // This adds the div to the iframe element itself, not to the iframe's 21 // contentDocument. It's done here because the HTML parser treats the 22 // content of iframe as a text node. 23 var div = document.createElement("div"); 24 iframe.appendChild(div); 25 26 await Promise.all([ 27 trusted_request(div, iframe.contentDocument.body), 28 fullScreenChange(), 29 ]); 30 assert_equals(document.fullscreenElement, div); 31 }, "Element ready check for child of a fullscreen iframe"); 32 </script>