tor-browser

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

opaque-origin-sandbox.html (1113B)


      1 <!DOCTYPE html>
      2 <script>
      3  'use strict'
      4 
      5  // Sends two messages to its creator:
      6  // (1) The result of showDirectoryPicker().
      7  // (2) The result of navigator.storage.getDirectory().
      8 
      9  function post_message(data) {
     10    if (window.parent !== null) {
     11      window.parent.postMessage(data, { targetOrigin: '*' });
     12    }
     13    if (window.opener !== null) {
     14      window.opener.postMessage(data, { targetOrigin: '*' });
     15    }
     16  }
     17 
     18  try {
     19    window.showDirectoryPicker()
     20      .then(() => {
     21        post_message('showDirectoryPicker(): FULFILLED');
     22      }).catch(error => {
     23        post_message(`showDirectoryPicker(): REJECTED: ${error.name}`);
     24      });
     25  } catch (error) {
     26    post_message(`showDirectoryPicker(): EXCEPTION: ${error.name}`);
     27  }
     28 
     29  try {
     30    navigator.storage.getDirectory()
     31      .then(() => {
     32        post_message('navigator.storage.getDirectory(): FULFILLED');
     33      }).catch(error => {
     34        post_message(`navigator.storage.getDirectory(): REJECTED: ${error.name}`);
     35      });
     36  } catch (error) {
     37    post_message(`navigator.storage.getDirectory(): EXCEPTION: ${error.name}`);
     38  }
     39 </script>