delegate-fullscreen-request-subframe-cross-origin.https.sub.tentative.html (2427B)
1 <!DOCTYPE html> 2 <!-- 3 Tentative due to: 4 https://github.com/WICG/capability-delegation/issues/10 5 --> 6 <title>Capability Delegation of Fullscreen Requests: Subframe Cross-Origin</title> 7 <script src="/common/get-host-info.sub.js"></script> 8 <script src="/resources/testharness.js"></script> 9 <script src="/resources/testharnessreport.js"></script> 10 <script src="/resources/testdriver.js"></script> 11 <script src="/resources/testdriver-actions.js"></script> 12 <script src="/resources/testdriver-vendor.js"></script> 13 <script src="resources/utils.js"></script> 14 15 <div> 16 Verifies that element.requestFullscreen() calls from a cross-origin subframe without user 17 activation work if and only if the top frame has user activation and it delegates the capability. 18 19 https://wicg.github.io/capability-delegation/spec.html 20 21 See wpt/html/user-activation/propagation*.html for frame tree user activation visibility tests. 22 </div> 23 24 <iframe allow="fullscreen" width="300px" height="50px"> 25 </iframe> 26 27 <script> 28 const origin = get_host_info().HTTPS_REMOTE_ORIGIN; 29 document.querySelector("iframe").src = origin + "/html/capability-delegation/resources/delegate-fullscreen-request-recipient.html"; 30 31 function testCrossOriginSubframeFullscreenDelegation(capability, activate, expectation) { 32 const message = {"type": "make-fullscreen-request"}; 33 const expectationType = expectation ? "succeeds" : "fails"; 34 const delegationType = capability ? "with delegation" : "without delegation"; 35 const activationType = activate ? "with user activation" : "with no user activation"; 36 37 promise_test(async () => { 38 const data = await postCapabilityDelegationMessage(frames[0], message, origin, capability, activate); 39 assert_equals(data.result, expectation ? "success" : "failure"); 40 }, `Fullscreen requests from a cross-origin subframe ${expectationType} ${delegationType} from an opener ${activationType}`); 41 } 42 43 promise_setup(async () => { 44 // Make sure the recipient iframe has loaded. 45 return getMessageData("recipient-loaded", frames[0]); 46 }); 47 48 testCrossOriginSubframeFullscreenDelegation(/*capability=*/"", /*activate=*/false, /*expectation=*/false); 49 testCrossOriginSubframeFullscreenDelegation(/*capability=*/"", /*activate=*/true, /*expectation=*/false); 50 testCrossOriginSubframeFullscreenDelegation(/*capability=*/"fullscreen", /*activate=*/true, /*expectation=*/true); 51 </script>