tor-browser

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

test_storagePermissionsReject.html (1598B)


      1 <html xmlns="http://www.w3.org/1999/xhtml">
      2  <head>
      3    <title>Storage Permission Restrictions</title>
      4 
      5    <script src="/tests/SimpleTest/SimpleTest.js"></script>
      6    <script type="text/javascript" src="storagePermissionsUtils.js"></script>
      7    <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
      8  </head>
      9  <body>
     10    <iframe></iframe>
     11 
     12    <script type="text/javascript">
     13 
     14 task(async function() {
     15  await setCookieBehavior(BEHAVIOR_REJECT);
     16 
     17  await runTestInWindow(async function() {
     18    // We should be unable to access storage
     19    await storagePrevented();
     20 
     21    // Same origin iframes should be blocked.
     22    await runIFrame("frameStoragePrevented.html");
     23    await runIFrame("frameStorageNullprincipal.sjs");
     24    await runIFrame("frameStorageChrome.html?allowed=no&blockSessionStorage=yes");
     25 
     26    // Sandboxed iframes should have the null principal, and thus can't access storage
     27    document.querySelector('iframe').setAttribute('sandbox', 'allow-scripts');
     28    await runIFrame("frameStoragePrevented.html#nullprincipal");
     29    await runIFrame("frameStorageNullprincipal.sjs");
     30    document.querySelector('iframe').removeAttribute('sandbox');
     31 
     32    // thirdparty iframes should be blocked.
     33    await runIFrame(thirdparty + "frameStoragePrevented.html");
     34    await runIFrame(thirdparty + "frameStorageNullprincipal.sjs");
     35    await runIFrame(thirdparty + "frameStorageChrome.html?allowed=no&blockSessionStorage=yes");
     36 
     37    // Workers should be unable to access storage
     38    await runWorker("workerStoragePrevented.js#outer");
     39  });
     40 });
     41 
     42    </script>
     43  </body>
     44 </html>