tor-browser

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

instantiation-error-5.html (1146B)


      1 <!DOCTYPE html>
      2 <title>Handling of instantiation errors, 5</title>
      3 
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <script>
      7    setup({allow_uncaught_exception: true});
      8 
      9    const test_load = async_test(
     10        "Test that loading a graph in which a module is already " +
     11        "errored results an error.");
     12 
     13    window.log = [];
     14    window.addEventListener("error", ev => {
     15      test_load.step(() => assert_equals(ev.error.constructor, SyntaxError));
     16      log.push(ev.message);
     17    });
     18 
     19    window.addEventListener("load", test_load.step_func_done(ev => {
     20      assert_equals(log.length, 4, 'Log length');
     21      assert_equals(log[1], 1);
     22      assert_equals(log[3], 2);
     23      assert_not_equals(log[0], log[2],
     24        'Instantiation error objects for different root scripts');
     25    }));
     26 
     27    function unreachable() { log.push("unexpected"); }
     28 </script>
     29 <script type="module" src="./instantiation-error-5a.js"
     30    onerror="unreachable()" onload="log.push(1)"></script>
     31 <script type="module" src="./instantiation-error-5d.js"
     32    onerror="unreachable()" onload="log.push(2)"></script>