tor-browser

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

opaque-origin-sandbox.html (1506B)


      1 <!DOCTYPE html>
      2 <script>
      3  'use strict'
      4 
      5  // Sends the result of navigator.storageBuckets.open('bucket').
      6 
      7  function post_message(data) {
      8    if (window.parent !== null) {
      9      window.parent.postMessage(data, { targetOrigin: '*' });
     10    }
     11    if (window.opener !== null) {
     12      window.opener.postMessage(data, { targetOrigin: '*' });
     13    }
     14  }
     15 
     16  try {
     17    navigator.storageBuckets.open('opaque-origin-bucket')
     18      .then(() => {
     19        post_message('navigator.storageBuckets.open(): FULFILLED');
     20      }).catch(error => {
     21        post_message(
     22          `navigator.storageBuckets.open(): REJECTED: ${error.name}`);
     23      });
     24  } catch (error) {
     25    post_message(`navigator.storageBuckets.open(): EXCEPTION: ${error.name}`);
     26  }
     27 
     28  try {
     29    navigator.storageBuckets.keys()
     30      .then(() => {
     31        post_message('navigator.storageBuckets.keys(): FULFILLED');
     32      }).catch(error => {
     33        post_message(
     34          `navigator.storageBuckets.keys(): REJECTED: ${error.name}`);
     35      });
     36  } catch (error) {
     37    post_message(`navigator.storageBuckets.keys(): EXCEPTION: ${error.name}`);
     38  }
     39 
     40  try {
     41    navigator.storageBuckets.delete('opaque-origin-bucket')
     42      .then(() => {
     43        post_message('navigator.storageBuckets.delete(): FULFILLED');
     44      }).catch(error => {
     45        post_message(
     46          `navigator.storageBuckets.delete(): REJECTED: ${error.name}`);
     47      });
     48  } catch (error) {
     49    post_message(`navigator.storageBuckets.delete(): EXCEPTION: ${error.name}`);
     50  }
     51 </script>