tor-browser

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

test_custom_element_uncatchable_exception.html (1117B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=1407669
      5 -->
      6 <head>
      7  <title>Test custom elements runtime exception</title>
      8  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      9  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
     10 </head>
     11 <body>
     12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1407669">Bug 1407669</a>
     13 <script type="text/javascript">
     14 
     15 SimpleTest.waitForExplicitFinish();
     16 SpecialPowers.pushPrefEnv({set: [['dom.expose_test_interfaces', true]]}, function() {
     17  window.onerror = function (e) {
     18    ok(false, "How did we get here!?");
     19  }
     20 
     21  class Foo extends HTMLElement {
     22    constructor() {
     23      super()
     24      TestFunctions.throwUncatchableException();
     25    }
     26  }
     27 
     28  customElements.define("test-custom-element", Foo);
     29  let element = document.createElement("test-custom-element");
     30  is(element instanceof HTMLUnknownElement, true, "It should be a HTMLUnknownElement when uncatchable exception throws in constructor");
     31  ok(true, "Uncatchable exception should not report");
     32  SimpleTest.finish();
     33 });
     34 
     35 </script>
     36 </body>
     37 </html>