tor-browser

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

test_exceptionSanitization.html (1587B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=1295322
      5 -->
      6 <head>
      7  <meta charset="utf-8">
      8  <title>Test for Bug 1295322</title>
      9  <script src="/tests/SimpleTest/SimpleTest.js"></script>
     10  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
     11 </head>
     12 <body>
     13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1295322">Mozilla Bug 1295322</a>
     14 <p id="display"></p>
     15 <div id="content" style="display: none">
     16 
     17 </div>
     18 <pre id="test">
     19 </pre>
     20  <script type="application/javascript">
     21  /* global TestFunctions */
     22    SimpleTest.waitForExplicitFinish();
     23    async function runTests() {
     24      await SpecialPowers.pushPrefEnv({set: [["dom.expose_test_interfaces", true]]});
     25 
     26      var t = new TestFunctions();
     27 
     28      try {
     29        t.testThrowNsresult();
     30      } catch (e) {
     31        try {
     32          is(e.name, "NS_BINDING_ABORTED", "Should have the right exception");
     33          is(e.filename, location.href, "Should not be seeing where the exception really came from");
     34        } catch (e2) {
     35          ok(false, "Should be able to work with the exception");
     36        }
     37      }
     38 
     39      try {
     40        t.testThrowNsresultFromNative();
     41      } catch (e) {
     42        try {
     43          is(e.name, "NS_ERROR_UNEXPECTED", "Should have the right exception");
     44          is(e.filename, location.href, "Should not be seeing where the exception really came from");
     45        } catch (e2) {
     46          ok(false, "Should be able to work with the exception");
     47        }
     48      }
     49 
     50      SimpleTest.finish();
     51    }
     52 
     53    runTests();
     54  </script>
     55 </body>
     56 </html>