tor-browser

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

shared-worker-partitioned-cookies-3p-frame.html (1346B)


      1 <!DOCTYPE html>
      2 <head>
      3 <meta charset="utf-8"/>
      4 <meta name="timeout" content="long">
      5 <title>Service Worker: Partitioned Cookies 3P Iframe</title>
      6 <script src="/resources/testharness.js"></script>
      7 <script src="shared-worker-partitioned-cookies-helper.js"></script>
      8 </head>
      9 
     10 <body>
     11 <script>
     12 
     13 promise_test(async () => {
     14  const worker = new SharedWorker('./shared-worker-echo-cookies.js');
     15  const next_message = worker_message_generator(worker);
     16 
     17  worker.port.postMessage({type: 'test_message'});
     18  const msg1 = await next_message();
     19  assert_true(msg1.ok, 'Message passing');
     20 
     21  worker.port.postMessage({type: 'echo_cookies_http'});
     22  const msg2 = await next_message();
     23  assert_true(msg2.ok, 'Get cookies');
     24  assert_false(
     25      msg2.cookies.includes('__Host-partitioned'),
     26      'Cannot access partitioned cookie via HTTP');
     27  assert_true(
     28      msg2.cookies.includes('unpartitioned'),
     29      'Can access unpartitioned cookie via HTTP');
     30 
     31  worker.port.postMessage({type: 'echo_cookies_import'});
     32  const msg3 = await next_message();
     33  assert_true(msg3.ok, 'Get cookies');
     34  assert_false(
     35      msg3.cookies.includes('__Host-partitioned'),
     36      'Cannot access partitioned cookie via importScripts');
     37  assert_true(
     38      msg3.cookies.includes('unpartitioned'),
     39      'Can access unpartitioned cookie via importScripts');
     40 });
     41 
     42 </script>
     43 </body>