tor-browser

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

instantiation-error-8.html (1139B)


      1 <!DOCTYPE html>
      2 <title>Handling of instantiation errors, 8</title>
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <!-- The below module tree should fail to instantiate, since it references undefined identifier. -->
      6 <script type="module" src="instantiation-error-1.js"></script>
      7 <script>
      8 setup({allow_uncaught_exception: true});
      9 
     10 promise_test(t => {
     11  return new Promise(resolve => {
     12    window.addEventListener("error", e => {
     13      assert_equals(e.error.constructor, SyntaxError);
     14      resolve();
     15    }, { once: true });
     16  }).then(() => new Promise(resolve => {
     17    window.addEventListener("error", e => {
     18      assert_equals(e.error.constructor, SyntaxError);
     19      resolve();
     20    }, { once: true });
     21    // Load another module tree w/ previously instantiate-failed tree as its sub-tree.
     22    document.head.appendChild(Object.assign(
     23        document.createElement('script'),
     24        { type: 'module', innerText: 'import "./instantiation-error-1.js"'}));
     25  }));
     26 }, "Instantiate attempt on a tree w/ previously instantiate-failed tree as a sub-tree shouldn't crash.");
     27 </script>