tor-browser

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

instantiation-error-7.html (1323B)


      1 <!DOCTYPE html>
      2 <title>Handling of instantiation errors, 7</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    window.log = [];
     10 
     11    window.addEventListener("error", ev => log.push(ev.error));
     12 
     13    const test_load = async_test(
     14        "Test that ambiguous star exports lead to an instantiation error, " +
     15        "even when discovered through a star export, and that the correct " +
     16        "module is blamed.");
     17    // This is a variation of instantiation-error-6.html (see the explanation
     18    // there).
     19    window.addEventListener("load", test_load.step_func_done(ev => {
     20      const exn = log[0];
     21      assert_array_equals(log, [
     22          exn, 1,
     23          "instantiation-error-7d",
     24          "instantiation-error-7e",
     25          "instantiation-error-7c",
     26          "instantiation-error-7f",
     27          "instantiation-error-7b", 2
     28      ]);
     29      assert_equals(exn.constructor, SyntaxError);
     30    }));
     31 
     32    function unreachable() { log.push("unexpected"); }
     33 </script>
     34 <script type="module" src="./instantiation-error-7a.js"
     35    onerror="unreachable()" onload="log.push(1)"></script>
     36 <script type="module" src="./instantiation-error-7b.js"
     37    onerror="unreachable()" onload="log.push(2)"></script>