tor-browser

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

test_securityerrors-manual.html (1322B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <title>FileReader SecurityError Test</title>
      4 <link rel="author" title="Intel" href="http://www.intel.com">
      5 <link rel="help" href="https://w3c.github.io/FileAPI/#dfn-error-codes">
      6 <script src="/resources/testharness.js"></script>
      7 <script src="/resources/testharnessreport.js"></script>
      8 <form name="upload">
      9  <input type="file" id="fileChooser"><br><input type="button" id="start" value="start">
     10 </form>
     11 
     12 <div>
     13  <p>Test steps:</p>
     14  <ol>
     15    <li>Select a system sensitive file (e.g. files in /usr/bin, password files,
     16        and other native operating system executables) in the file inputbox.</li>
     17    <li>Click the 'start' button.</li>
     18    </ol>
     19 </div>
     20 
     21 <script>
     22 
     23  const fileChooser = document.querySelector('#fileChooser');
     24 
     25  setup({explicit_done: true});
     26  setup({explicit_timeout: true});
     27 
     28  on_event(document.querySelector('#start'), 'click', () => {
     29    async_test(t => {
     30      const reader = new FileReader();
     31      reader.readAsArrayBuffer(fileChooser.files[0]);
     32      reader.onloadend = t.step_func_done(event => {
     33        assert_equals(event.target.readyState, FileReader.DONE);
     34        assert_equals(reader.error.name, "SecurityError");
     35      });
     36    }, 'FileReader.error should be SECURITY_ERROR if the file is a system sensitive file');
     37    done();
     38  });
     39 
     40 </script>