tor-browser

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

delegation-consumes-activation.https.tentative.html (2096B)


      1 <!DOCTYPE html>
      2 <!--
      3   Tentative due to:
      4     https://github.com/whatwg/html/issues/4008
      5 -->
      6 <title>Capability Delegation: Consumes User Activation</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  Test that capability delegation consumes transient user activation.
     16 
     17  https://wicg.github.io/capability-delegation/spec.html
     18 </div>
     19 
     20 <iframe width="300px" height="50px"></iframe>
     21 
     22 <script>
     23  function sendCapabilityDelegationMessageIgnoringException(origin, capability) {
     24      try {
     25          frames[0].postMessage("any_message", {targetOrigin: origin, delegate: capability});
     26      } catch (e) {}
     27  }
     28 
     29  let capability_to_delegate;
     30 
     31  promise_setup(async () => {
     32      capability_to_delegate = await findOneCapabilitySupportingDelegation();
     33      assert_true(!!capability_to_delegate, "The user agent supports delegating at least one capability");
     34  });
     35 
     36  promise_test(async () => {
     37      assert_false(navigator.userActivation.isActive);
     38 
     39      await test_driver.bless();
     40      assert_true(navigator.userActivation.isActive, "User activation is available initially");
     41 
     42      sendCapabilityDelegationMessageIgnoringException("/", "blah");
     43      assert_true(navigator.userActivation.isActive,
     44                  "User activation is not consumed by delegation of an unknown delegation");
     45 
     46      sendCapabilityDelegationMessageIgnoringException("*", capability_to_delegate);
     47      assert_true(navigator.userActivation.isActive,
     48                  "User activation is not consumed by known delegation to disallowed targetOrigin");
     49 
     50      sendCapabilityDelegationMessageIgnoringException("/", capability_to_delegate);
     51      assert_false(navigator.userActivation.isActive,
     52                   "User activation is consumed by supported delegation");
     53 
     54  }, "Capability delegation consumes transient user activation");
     55 </script>