tor-browser

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

errors-manual.html (2204B)


      1 <!DOCTYPE html>
      2 <meta charset=utf-8>
      3 <title>Entries API: Errors manual test</title>
      4 <link rel=help href="https://wicg.github.io/entries-api">
      5 <script src="/resources/testharness.js"></script>
      6 <script src="/resources/testharnessreport.js"></script>
      7 <script src="support.js"></script>
      8 
      9 <script>
     10 entry_test((t, entry) => {
     11  entry.getFile(
     12    NOT_FOUND_PATHS[0],
     13    {},
     14    t.unreached_func('getFile should fail'),
     15    t.step_func(error => {
     16      assert_equals(typeof error.name, 'string', 'Error has name property');
     17      assert_equals(typeof error.message, 'string', 'Error has message property');
     18      assert_equals(error.name, 'NotFoundError', 'error is NotFoundError');
     19      t.done();
     20    }));
     21 }, 'Errors - NotFoundError');
     22 
     23 entry_test((t, entry) => {
     24  entry.getFile(
     25    DIR_PATHS[0],
     26    {},
     27    t.unreached_func('getFile should fail'),
     28    t.step_func(error => {
     29      assert_equals(typeof error.name, 'string', 'Error has name property');
     30      assert_equals(typeof error.message, 'string', 'Error has message property');
     31      assert_equals(error.name, 'TypeMismatchError', 'error is TypeMismatchError');
     32      t.done();
     33    }));
     34 }, 'Errors - TypeMismatchError');
     35 
     36 entry_test((t, entry) => {
     37  entry.getFile(
     38    FILE_PATHS[0],
     39    {create: true},
     40    t.unreached_func('getFile should fail'),
     41    t.step_func(error => {
     42      assert_equals(typeof error.name, 'string', 'Error has name property');
     43      assert_equals(typeof error.message, 'string', 'Error has message property');
     44      assert_equals(error.name, 'SecurityError', 'error is SecurityError');
     45      t.done();
     46    }));
     47 }, 'Errors - SecurityError');
     48 
     49 entry_test((t, entry) => {
     50  const reader = entry.createReader();
     51  reader.readEntries(() => {}, t.unreached_func('readEntries should succeed'));
     52  reader.readEntries(
     53    t.unreached_func('readEntries() should fail if already reading'),
     54    t.step_func(error => {
     55      assert_equals(typeof error.name, 'string', 'Error has name property');
     56      assert_equals(typeof error.message, 'string', 'Error has message property');
     57      assert_equals(error.name, 'InvalidStateError', 'error is InvalidStateError');
     58      t.done();
     59    }));
     60 }, 'Errors - InvalidStateError');
     61 </script>