tor-browser

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

cross-origin-cookies-anonymous-client-ip-duplicate.https.html (1937B)


      1 <!DOCTYPE html>
      2 <meta name="timeout" content="long">
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <script src="/resources/testdriver.js"></script>
      6 <script src='/resources/testdriver-vendor.js'></script>
      7 <script src="/common/dispatcher/dispatcher.js"></script>
      8 <script src="/common/utils.js"></script>
      9 <script src="../../resources/utils.js"></script>
     10 <script src="../resources/utils.sub.js"></script>
     11 <script>
     12  setup(() => assertSpeculationRulesIsSupported());
     13 
     14  promise_test(async t => {
     15    await test_driver.delete_all_cookies();
     16 
     17    let executor = 'cookies.py';
     18    let agent = await spawnWindow(t, { executor });
     19    let response_cookies = await agent.getResponseCookies();
     20    let request_cookies = await agent.getRequestCookies();
     21    assert_equals(request_cookies["count"], undefined);
     22    assert_equals(request_cookies["type"], undefined);
     23    assert_equals(response_cookies["count"], "1");
     24    assert_equals(response_cookies["type"], "navigate");
     25 
     26    let nextUrl = agent.getExecutorURL({ executor, hostname: CROSS_ORIGIN_HOST_THAT_WORKS_WITH_ACIWCO, page: 2 });
     27    await agent.forceSinglePrefetch(nextUrl, { requires: ["anonymous-client-ip-when-cross-origin"] });
     28    await agent.forceSinglePrefetch(nextUrl);
     29    await agent.navigate(nextUrl);
     30 
     31    response_cookies = await agent.getResponseCookies();
     32    request_cookies = await agent.getRequestCookies();
     33    assert_equals(request_cookies["count"], undefined);
     34    assert_equals(request_cookies["type"], undefined);
     35    assert_equals(response_cookies["count"], "1");
     36    assert_equals(response_cookies["type"], "prefetch");
     37 
     38    let requestHeaders = await agent.getRequestHeaders();
     39    assert_prefetched_anonymous_client_ip(requestHeaders);
     40  }, "speculation rules based prefetch should not use cookies for cross origin urls and should issue only the IP-anonymized request if that one is first.");
     41 </script>