tor-browser

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

test_exceptions_from_jsimplemented.html (1639B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=923010
      5 -->
      6 <head>
      7  <meta charset="utf-8">
      8  <title>Test for Bug 923010</title>
      9  <script src="/tests/SimpleTest/SimpleTest.js"></script>
     10  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
     11  <script type="application/javascript">
     12  /** Test for Bug 923010 */
     13  try {
     14    var conn = new RTCPeerConnection();
     15 
     16    var candidate = new RTCIceCandidate({candidate: "x" });
     17    conn.addIceCandidate(candidate)
     18    .then(function() {
     19      ok(false, "addIceCandidate succeeded when it should have failed");
     20    }, function(reason) {
     21      is(reason.lineNumber, 17, "Rejection should have been on line 17");
     22      is(reason.message,
     23         "Invalid candidate (both sdpMid and sdpMLineIndex are null).",
     24         "Should have the rejection we expect");
     25    })
     26    .catch(function(reason) {
     27      ok(false, "unexpected error: " + reason);
     28    });
     29  } catch (e) {
     30    // b2g has no WebRTC, apparently
     31    todo(false, "No WebRTC on b2g yet");
     32  }
     33 
     34  conn.close();
     35  try {
     36      conn.setIdentityProvider("example.com", { protocol: "foo" });
     37      ok(false, "That call to setIdentityProvider should have thrown");
     38    } catch (e) {
     39      is(e.lineNumber, 36, "Exception should have been on line 36");
     40      is(e.message,
     41         "Peer connection is closed",
     42         "Should have the exception we expect");
     43    }
     44 
     45  </script>
     46 </head>
     47 <body>
     48 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=923010">Mozilla Bug 923010</a>
     49 <p id="display"></p>
     50 <div id="content" style="display: none">
     51 
     52 </div>
     53 <pre id="test">
     54 </pre>
     55 </body>
     56 </html>