tor-browser

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

shared-storage-writable-clear.tentative.https.sub.html (2162B)


      1 <!doctype html>
      2 <body>
      3  <script src=/resources/testharness.js></script>
      4  <script src=/resources/testharnessreport.js></script>
      5  <script src=/common/utils.js></script>
      6  <script src=/common/get-host-info.sub.js></script>
      7  <script src=/fenced-frame/resources/utils.js></script>
      8  <script src=/shared-storage/resources/util.js></script>
      9  <script>
     10    'use strict';
     11 
     12   const sameOriginClearUrl =
     13      `/shared-storage/resources/shared-storage-write.py?write=clear`;
     14    const sameOrigin = generateURL(sameOriginClearUrl, []).origin;
     15    const crossOrigin = 'https://{{domains[www]}}:{{ports[https][0]}}';
     16    const crossOriginClearUrl = crossOrigin + sameOriginClearUrl;
     17 
     18    promise_test(async t => {
     19      await sharedStorage.set("hello", "there");
     20      await verifyKeyValueForOrigin('hello', 'there', sameOrigin);
     21 
     22      let response = await fetch(sameOriginClearUrl,
     23                                 {sharedStorageWritable: true});
     24      let sharedStorageWritableHeader = await response.text();
     25      assert_equals(sharedStorageWritableHeader, "?1");
     26 
     27      // JS does not see the `Shared-Storage-Write` response header.
     28      assert_false(!!response.headers.get('Shared-Storage-Write'));
     29 
     30      await verifyKeyNotFoundForOrigin('hello', sameOrigin);
     31    }, 'Clearing from shared storage via the \'Shared-Storage-Write\' header '
     32       + 'for a same-origin shared storage fetch request');
     33 
     34    promise_test(async t => {
     35      await setKeyValueForOrigin('hello', 'there', crossOrigin);
     36      await verifyKeyValueForOrigin('hello', 'there', crossOrigin);
     37 
     38      let response = await fetch(crossOriginClearUrl,
     39                                 {sharedStorageWritable: true});
     40      let sharedStorageWritableHeader = await response.text();
     41      assert_equals(sharedStorageWritableHeader, "?1");
     42 
     43      // JS does not see the `Shared-Storage-Write` response header.
     44      assert_false(!!response.headers.get('Shared-Storage-Write'));
     45 
     46      await verifyKeyNotFoundForOrigin('hello', crossOrigin);
     47    }, 'Clearing from shared storage via the \'Shared-Storage-Write\' header '
     48       + 'for a cross-origin shared storage fetch request');
     49  </script>
     50 </body>