tor-browser

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

restrictions.https.html (1297B)


      1 <!DOCTYPE html>
      2 <title>Same-origin prerendering cannot access some APIs</title>
      3 <meta name="timeout" content="long">
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <script src="/common/utils.js"></script>
      7 <script src="../resources/utils.js"></script>
      8 <script src="resources/utils.js"></script>
      9 
     10 <body>
     11 <script>
     12 setup(() => assertSpeculationRulesIsSupported());
     13 
     14 test_prerender_restricted(
     15  () => navigator.clipboard.writeText(location.href),
     16  "NotAllowedError", "prerendering pages should not be able to access the clipboard via the Async Clipboard API");
     17 
     18 test_prerender_restricted(async () => {
     19  const canvas = document.createElement('canvas');
     20  document.body.appendChild(canvas);
     21  await canvas.requestPointerLock();
     22 }, "WrongDocumentError", "prerendering pages should not be able to access the pointer-lock API");
     23 
     24 test_prerender_restricted(async () => {
     25  const div = document.createElement('div');
     26  document.body.appendChild(div);
     27  await div.requestFullscreen();
     28 }, "TypeError", "prerendering pages should not be able to access the FullScreen API");
     29 
     30 test_prerender_defer(() => new Promise(
     31  resolve => navigator.geolocation.getCurrentPosition(p => resolve(p.toString()))),
     32  "Geolocation API should be deferred");
     33 </script>