|
1 <!DOCTYPE HTML> |
|
2 <html class="reftest-wait"> |
|
3 <!-- |
|
4 https://bugzilla.mozilla.org/show_bug.cgi?id=812785 |
|
5 --> |
|
6 <head> |
|
7 <meta charset="utf-8"> |
|
8 <title>Bug 812785 - WebRTC use-after-free crash</title> |
|
9 <script type="application/javascript"> |
|
10 var pc1, pc2, pc1_offer, pc2_answer, localAudio, remoteAudio; |
|
11 |
|
12 function onFailure(code) { |
|
13 stop(); |
|
14 } |
|
15 |
|
16 function stop() { |
|
17 pc1.close(); pc1 = null; |
|
18 pc2.close(); pc2 = null; |
|
19 |
|
20 var index = localStorage.index || 0; |
|
21 if (index < 5) { |
|
22 localStorage.index = index + 1; |
|
23 window.location.reload(); |
|
24 } |
|
25 else { |
|
26 finish(); |
|
27 } |
|
28 } |
|
29 |
|
30 function start() { |
|
31 localAudio = document.getElementById("local"); |
|
32 remoteAudio = document.getElementById("remote"); |
|
33 |
|
34 var stream = localAudio.mozCaptureStreamUntilEnded(); |
|
35 |
|
36 pc1 = new mozRTCPeerConnection(); |
|
37 pc2 = new mozRTCPeerConnection(); |
|
38 |
|
39 pc1.addStream(stream); |
|
40 pc1.createOffer(function (offer) { |
|
41 pc1_offer = offer; |
|
42 pc1.setLocalDescription(pc1_offer, function () { |
|
43 pc2.setRemoteDescription(pc1_offer, function () { |
|
44 pc2.createAnswer(function (answer) { |
|
45 pc2_answer = answer; |
|
46 pc2.setLocalDescription(pc2_answer, function () { |
|
47 pc1.setRemoteDescription(pc2_answer, function step6() { |
|
48 stop(); |
|
49 }, onFailure); |
|
50 }, onFailure); |
|
51 }, onFailure); |
|
52 }, onFailure); |
|
53 }, onFailure); |
|
54 }, onFailure); |
|
55 } |
|
56 |
|
57 function finish() { |
|
58 delete localStorage["index"]; |
|
59 |
|
60 document.documentElement.removeAttribute("class"); |
|
61 } |
|
62 </script> |
|
63 </head> |
|
64 |
|
65 <body onload="setTimeout(start, 100)"> |
|
66 <audio id="local" controls autoplay><source type="audio/wav" src="" /></audio> |
|
67 <audio id="remote" controls></audio> |
|
68 </body> |
|
69 </html> |
|
70 |