DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Mercurial (b6d82b1a6b02)

VCS Links

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
<!DOCTYPE HTML>
<html>
<head>
  <script type="application/javascript" src="pc.js"></script>
</head>
<body>
<pre id="test">
<script type="application/javascript">
  createHTML({
    bug: "857765",
    title: "Throw in PeerConnection callbacks"
  });

runNetworkTest(function () {
  function finish() {
    window.onerror = oldOnError;
    is(error_count, 7, "Seven expected errors verified.");
    networkTestFinished();
  }

  function getFail() {
    return err => {
      window.onerror = oldOnError;
      generateErrorCallback()(err);
    };
  }

  let error_count = 0;
  let oldOnError = window.onerror;
  window.onerror = (errorMsg, url, lineNumber) => {
    if (!errorMsg.includes("Expected")) {
      getFail()(errorMsg);
    }
    error_count += 1;
    info("onerror " + error_count + ": " + errorMsg);
    if (error_count == 7) {
      finish();
    }
    throw new Error("window.onerror may throw");
    return false;
  }

  let pc0, pc1, pc2;
  // Test failure callbacks (limited to 1 for now)
  pc0 = new RTCPeerConnection();
  pc0.close();
  pc0.createOffer(getFail(), function(err) {
    pc1 = new RTCPeerConnection();
    pc2 = new RTCPeerConnection();

    // Test success callbacks (happy path)
    navigator.mozGetUserMedia({video:true}, function(video1) {
      pc1.addStream(video1);
      pc1.createOffer(function(offer) {
        pc1.setLocalDescription(offer, function() {
          pc2.setRemoteDescription(offer, function() {
            pc2.createAnswer(function(answer) {
              pc2.setLocalDescription(answer, function() {
                pc1.setRemoteDescription(answer, function() {
                  throw new Error("Expected");
                }, getFail());
                throw new Error("Expected");
              }, getFail());
              throw new Error("Expected");
            }, getFail());
            throw new Error("Expected");
          }, getFail());
          throw new Error("Expected");
        }, getFail());
        throw new Error("Expected");
      }, getFail());
    }, getFail());
    throw new Error("Expected");
  });
});

</script>
</pre>
</body>
</html>