Bug 1227781 - Fix crash with bogus STUN parameters. r=bwc

This commit is contained in:
EKR 2015-11-30 12:15:19 -08:00
parent be2183efb0
commit e30ee61553
3 changed files with 46 additions and 1 deletions

View File

@ -216,6 +216,7 @@ skip-if = toolkit == 'gonk' || (android_version == '18' && debug) # b2g (Bug 105
[test_peerConnection_remoteReofferRollback.html]
skip-if = toolkit == 'gonk' || buildapp == 'mulet' # b2g (Bug 1059867)
[test_selftest.html]
# Bug 1227781: Crash with bogus TURN server.
[test_peerConnection_bug1227781.html]
# Bug 950317: Hack for making a cleanup hook after finishing all WebRTC cases
[test_zmedia_cleanup.html]

View File

@ -0,0 +1,33 @@
<!DOCTYPE HTML>
<html>
<head>
<script type="application/javascript" src="pc.js"></script>
</head>
<body>
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "1227781",
title: "Test with invalid TURN server"
});
var turnConfig = { iceServers: [{"username":"mozilla","credential"
:"mozilla","url":"turn:test@10.0.0.1"}] };
var test;
runNetworkTest(function (options) {
var exception = false;
try {
pc = new RTCPeerConnection(turnConfig);
} catch (e) {
info(e);
exception = true;
}
is(exception, true, "Exception fired");
ok("Success");
SimpleTest.finish();
});
</script>
</pre>
</body>
</html>

View File

@ -652,7 +652,10 @@ PeerConnectionImpl::Initialize(PeerConnectionObserver& aObserver,
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(aThread);
#ifndef MOZILLA_EXTERNAL_LINKAGE
mThread = do_QueryInterface(aThread);
#endif
MOZ_ASSERT(mThread);
CheckThread();
mPCObserver = do_GetWeakReference(&aObserver);
@ -827,6 +830,10 @@ PeerConnectionImpl::Initialize(PeerConnectionObserver& aObserver,
nsISupports* aThread,
ErrorResult &rv)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(aThread);
mThread = do_QueryInterface(aThread);
PeerConnectionConfiguration converted;
nsresult res = converted.Init(aConfiguration);
if (NS_FAILED(res)) {
@ -2491,6 +2498,10 @@ PeerConnectionImpl::PluginCrash(uint32_t aPluginID,
void
PeerConnectionImpl::RecordEndOfCallTelemetry() const
{
if (!mJsepSession) {
return;
}
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
// Bitmask used for WEBRTC/LOOP_CALL_TYPE telemetry reporting
static const uint32_t kAudioTypeMask = 1;