tor-browser

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

pointerlock_without_gesture.html (1200B)


      1 <!DOCTYPE html>
      2 <html>
      3 <body>
      4 <meta name="timeout" content="long">
      5 <script src="/resources/testharness.js"></script>
      6 <script src="/resources/testharnessreport.js"></script>
      7 <script src="/resources/testdriver.js"></script>
      8 <script src="/resources/testdriver-actions.js"></script>
      9 <script src="/resources/testdriver-vendor.js"></script>
     10 </head>
     11 <body>
     12    <h2>Description</h2>
     13    <p>This test validates that pointer lock does not work without user activation.</p>
     14    <hr/>
     15 
     16    <div id="target">Target</div>
     17 
     18    <script type="text/javascript" >
     19        promise_test(async t => {
     20            const target = document.getElementById('target');
     21 
     22            document.addEventListener('pointerlockchange', t.unreached_func("Must not acquire pointer lock."));
     23 
     24            // Request pointer lock twice to ensure two failing promises are returned and both are rejected.
     25            const p1 = target.requestPointerLock();
     26            const p2 = target.requestPointerLock();
     27 
     28            // ensure that both promises are rejected
     29            await promise_rejects_dom(t, "NotAllowedError", p1);
     30            await promise_rejects_dom(t, "NotAllowedError", p2);
     31        });
     32    </script>
     33    </body>
     34 </html>