tor-browser

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

test_peerConnection_restartIceBadAnswer.html (1866B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4  <script type="application/javascript" src="pc.js"></script>
      5 </head>
      6 <body>
      7 <pre id="test">
      8 <script type="application/javascript">
      9  createHTML({
     10    bug: "1413709",
     11    title: "Renegotiation: bad answer ICE credentials"
     12  });
     13 
     14  var test;
     15  runNetworkTest(function (options) {
     16    test = new PeerConnectionTest(options);
     17 
     18    addRenegotiation(test.chain,
     19      [
     20        function PC_LOCAL_ADD_SECOND_STREAM(test) {
     21          test.setMediaConstraints([{audio: true}],
     22                                   []);
     23          return test.pcLocal.getAllUserMedia([{audio: true}]);
     24        },
     25      ]
     26    );
     27 
     28    // If the offerer hasn't indicated ICE restart, then an answer
     29    // arriving during renegotiation that has modified ICE credentials
     30    // should cause an error
     31    test.chain.replaceAfter("PC_LOCAL_GET_ANSWER",
     32      [
     33        function PC_LOCAL_REWRITE_REMOTE_SDP_ICE_CREDS(test) {
     34          test._remote_answer.sdp =
     35            test._remote_answer.sdp.replace(/a=ice-pwd:.*\r\n/g,
     36                                            "a=ice-pwd:bad-pwd\r\n")
     37                                   .replace(/a=ice-ufrag:.*\r\n/g,
     38                                            "a=ice-ufrag:bad-ufrag\r\n");
     39        },
     40 
     41        function PC_LOCAL_EXPECT_SET_REMOTE_DESCRIPTION_FAIL(test) {
     42          return test.setRemoteDescription(test.pcLocal,
     43                                           test._remote_answer,
     44                                           STABLE)
     45           .then(() => ok(false, "setRemoteDescription must fail"),
     46                 e => is(e.name, "InvalidAccessError",
     47                         "setRemoteDescription must fail and did"));
     48         }
     49      ], 1 // replace after the second PC_LOCAL_GET_ANSWER
     50    );
     51 
     52    test.setMediaConstraints([{audio: true}], []);
     53    return test.run();
     54  });
     55 </script>
     56 </pre>
     57 </body>
     58 </html>