tor-browser

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

storageAccess.testdriver.sub.html (1230B)


      1 <!DOCTYPE html>
      2 <head>
      3  <title>TestDriver - Set Storage Access Command Tests</title>
      4  <script src="/cookies/resources/cookie-helper.sub.js"></script>
      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-vendor.js"></script>
      9  <script src="helpers.js"></script>
     10 </head>
     11 <body>
     12  <script>
     13    "use strict";
     14 
     15    // Use a different domain so that the cookie is cross-site.
     16    const wwwAlt = "https://{{hosts[alt][www]}}:{{ports[https][0]}}";
     17 
     18    promise_test(async t => {
     19      await SetFirstPartyCookie(wwwAlt);
     20      await MaybeSetStorageAccess("*", "*", "blocked");
     21      t.add_cleanup(async () => {
     22        await test_driver.delete_all_cookies();
     23        await MaybeSetStorageAccess("*", "*", "allowed");
     24      });
     25 
     26      const responder_html = `${wwwAlt}/storage-access-api/resources/script-with-cookie-header.py?script=embedded_responder.js`;
     27      const frame = await CreateFrame(responder_html);
     28 
     29      assert_false(await HasUnpartitionedCookie(frame), "Cross-site iframe should not be allowed to read unpartitioned cookies via document.cookie.");
     30    });
     31  </script>
     32 </body>