tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

delegate-fullscreen-request-subframe-same-origin.https.tentative.html (2283B)


      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 Same-Origin</title>
      7 <script src="/resources/testharness.js"></script>
      8 <script src="/resources/testharnessreport.js"></script>
      9 <script src="/resources/testdriver.js"></script>
     10 <script src="/resources/testdriver-actions.js"></script>
     11 <script src="/resources/testdriver-vendor.js"></script>
     12 <script src="resources/utils.js"></script>
     13 
     14 <div>
     15  Verifies that element.requestFullscreen() calls from a same-origin subframe without user
     16  activation work if and only if the top frame has user activation, regardless of whether it
     17  delegates the capability or not.
     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        src="./resources/delegate-fullscreen-request-recipient.html">
     26 </iframe>
     27 
     28 <script>
     29  function testSameOriginSubframeFullscreenDelegation(capability, activate, expectation) {
     30      const message = {"type": "make-fullscreen-request"};
     31      const expectationType = expectation ? "succeeds" : "fails";
     32      const delegationType = capability ? "with delegation" : "without delegation";
     33      const activationType = activate ? "with user activation" : "with no user activation";
     34 
     35      promise_test(async () => {
     36          const data = await postCapabilityDelegationMessage(frames[0], message, window.location, capability, activate);
     37          assert_equals(data.result, expectation ? "success" : "failure");
     38      }, `Fullscreen requests from a same-origin subframe ${expectationType} ${delegationType} from an opener ${activationType}`);
     39  }
     40 
     41  promise_setup(async () => {
     42      // Make sure the recipient iframe has loaded.
     43      return getMessageData("recipient-loaded", frames[0]);
     44  });
     45 
     46  testSameOriginSubframeFullscreenDelegation(/*capability=*/"", /*activate=*/false, /*expectation=*/false);
     47  testSameOriginSubframeFullscreenDelegation(/*capability=*/"", /*activate=*/true, /*expectation=*/true);
     48  testSameOriginSubframeFullscreenDelegation(/*capability=*/"fullscreen", /*activate=*/true, /*expectation=*/true);
     49 </script>