tor-browser

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

instantiation-error-1.html (1352B)


      1 <!DOCTYPE html>
      2 <title>Handling of instantiation errors, 1</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 missing exports lead to SyntaxError events on window and " +
     11        "load events on script");
     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      const msg = log[0];
     21      assert_array_equals(log, [msg, 1, msg, 2, msg, 3, msg, 4, msg, 5]);
     22    }));
     23 
     24    function unreachable() { log.push("unexpected"); }
     25 </script>
     26 <script type="module" src="./missing-export.js"
     27    onerror="unreachable()" onload="log.push(1)"></script>
     28 <script type="module" src="./missing-export.js"
     29    onerror="unreachable()" onload="log.push(2)"></script>
     30 <script type="module" src="./missing-export-nested.js"
     31    onerror="unreachable()" onload="log.push(3)"></script>
     32 <script type="module" src="./missing-export.js"
     33    onerror="unreachable()" onload="log.push(4)"></script>
     34 <script type="module" src="./missing-export-nested.js"
     35    onerror="unreachable()" onload="log.push(5)"></script>