mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-07 11:56:51 +00:00
Backed out changeset 33b1caee42d2 (bug 827843) for Android test failures.
This commit is contained in:
parent
459522e248
commit
3efa2175dc
@ -291,7 +291,9 @@ PeerConnection.prototype = {
|
||||
* call _executeNext, false if it doesn't have a callback.
|
||||
*/
|
||||
_queueOrRun: function(obj) {
|
||||
this._checkClosed();
|
||||
if (this._closed) {
|
||||
return;
|
||||
}
|
||||
if (!this._pending) {
|
||||
if (obj.type !== undefined) {
|
||||
this._pendingType = obj.type;
|
||||
@ -354,16 +356,6 @@ PeerConnection.prototype = {
|
||||
return true;
|
||||
},
|
||||
|
||||
// Ideally, this should be of the form _checkState(state),
|
||||
// where the state is taken from an enumeration containing
|
||||
// the valid peer connection states defined in the WebRTC
|
||||
// spec. See Bug 831756.
|
||||
_checkClosed: function() {
|
||||
if (this._closed) {
|
||||
throw new Error ("Peer connection is closed");
|
||||
}
|
||||
},
|
||||
|
||||
createOffer: function(onSuccess, onError, constraints) {
|
||||
if (!constraints) {
|
||||
constraints = {};
|
||||
@ -416,9 +408,6 @@ PeerConnection.prototype = {
|
||||
},
|
||||
|
||||
setLocalDescription: function(desc, onSuccess, onError) {
|
||||
// TODO -- if we have two setLocalDescriptions in the
|
||||
// queue,this code overwrites the callbacks for the first
|
||||
// one with the callbacks for the second one. See Bug 831759.
|
||||
this._onSetLocalDescriptionSuccess = onSuccess;
|
||||
this._onSetLocalDescriptionFailure = onError;
|
||||
|
||||
@ -446,9 +435,6 @@ PeerConnection.prototype = {
|
||||
},
|
||||
|
||||
setRemoteDescription: function(desc, onSuccess, onError) {
|
||||
// TODO -- if we have two setRemoteDescriptions in the
|
||||
// queue, this code overwrites the callbacks for the first
|
||||
// one with the callbacks for the second one. See Bug 831759.
|
||||
this._onSetRemoteDescriptionSuccess = onSuccess;
|
||||
this._onSetRemoteDescriptionFailure = onError;
|
||||
|
||||
@ -522,17 +508,14 @@ PeerConnection.prototype = {
|
||||
},
|
||||
|
||||
get localStreams() {
|
||||
this._checkClosed();
|
||||
return this._pc.localStreams;
|
||||
},
|
||||
|
||||
get remoteStreams() {
|
||||
this._checkClosed();
|
||||
return this._pc.remoteStreams;
|
||||
},
|
||||
|
||||
get localDescription() {
|
||||
this._checkClosed();
|
||||
let sdp = this._pc.localDescription;
|
||||
if (sdp.length == 0) {
|
||||
return null;
|
||||
@ -544,7 +527,6 @@ PeerConnection.prototype = {
|
||||
},
|
||||
|
||||
get remoteDescription() {
|
||||
this._checkClosed();
|
||||
let sdp = this._pc.remoteDescription;
|
||||
if (sdp.length == 0) {
|
||||
return null;
|
||||
@ -556,7 +538,6 @@ PeerConnection.prototype = {
|
||||
},
|
||||
|
||||
createDataChannel: function(label, dict) {
|
||||
this._checkClosed();
|
||||
if (dict &&
|
||||
dict.maxRetransmitTime != undefined &&
|
||||
dict.maxRetransmitNum != undefined) {
|
||||
@ -574,8 +555,6 @@ PeerConnection.prototype = {
|
||||
}
|
||||
|
||||
// Synchronous since it doesn't block.
|
||||
// TODO -- this may need to be revisited, based on how the
|
||||
// spec ends up defining data channel handling
|
||||
let channel = this._pc.createDataChannel(
|
||||
label, type, dict.outOfOrderAllowed, dict.maxRetransmitTime,
|
||||
dict.maxRetransmitNum
|
||||
@ -595,7 +574,7 @@ PeerConnection.prototype = {
|
||||
}
|
||||
};
|
||||
|
||||
// This is a separate object because we don't want to expose it to DOM.
|
||||
// This is a seperate object because we don't want to expose it to DOM.
|
||||
function PeerConnectionObserver(dompc) {
|
||||
this._dompc = dompc;
|
||||
}
|
||||
|
@ -19,7 +19,6 @@ MOCHITEST_FILES = \
|
||||
test_peerConnection_basicAudioVideo.html \
|
||||
test_peerConnection_basicAudioVideoCombined.html \
|
||||
test_peerConnection_basicVideo.html \
|
||||
test_peerConnection_bug827843.html \
|
||||
head.js \
|
||||
mediaStreamPlayback.js \
|
||||
pc.js \
|
||||
|
@ -1,115 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=827843
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Bug 827843: Ensure that localDescription and remoteDescription are null after close</title>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="head.js"></script>
|
||||
<script type="application/javascript" src="pc.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=827843">Make sure functions act correctly after close()</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
<audio id="audioPCLocal" controls></audio>
|
||||
<audio id="audioPCRemote" controls></audio>
|
||||
<audio id="audioLocal" controls></audio>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
var audioLocal;
|
||||
var audioPCLocal;
|
||||
var audioPCRemote;
|
||||
|
||||
var pcLocal;
|
||||
var pcRemote;
|
||||
|
||||
var test_data = {
|
||||
pcLocal: { audio: [], video: []},
|
||||
pcRemote: { audio: [], video: []}
|
||||
};
|
||||
|
||||
runTest(function () {
|
||||
audioLocal = document.getElementById("audioLocal");
|
||||
audioPCLocal = document.getElementById("audioPCLocal");
|
||||
audioPCRemote = document.getElementById("audioPCRemote");
|
||||
|
||||
pcLocal = new mozRTCPeerConnection();
|
||||
pcRemote = new mozRTCPeerConnection();
|
||||
|
||||
pcLocal.onaddstream = function (aObj) {
|
||||
test_data.pcLocal[aObj.type].push(aObj.stream);
|
||||
|
||||
if (aObj.type === "audio") {
|
||||
audioPCRemote.mozSrcObject = aObj.stream;
|
||||
audioPCRemote.play();
|
||||
}
|
||||
};
|
||||
|
||||
pcRemote.onaddstream = function (aObj) {
|
||||
test_data.pcRemote[aObj.type].push(aObj.stream);
|
||||
|
||||
if (aObj.type === "audio") {
|
||||
audioPCLocal.mozSrcObject = aObj.stream;
|
||||
audioPCLocal.play();
|
||||
}
|
||||
};
|
||||
|
||||
navigator.mozGetUserMedia({audio: true, fake: true}, function onSuccess(aLocalInputStream) {
|
||||
pcLocal.addStream(aLocalInputStream);
|
||||
|
||||
navigator.mozGetUserMedia({audio: true, fake: true}, function onSuccess(aRemoteInputStream) {
|
||||
pcRemote.addStream(aRemoteInputStream);
|
||||
|
||||
audioLocal.mozSrcObject = aLocalInputStream;
|
||||
audioLocal.play();
|
||||
|
||||
PeerConnection.handShake(pcLocal, pcRemote, function () {
|
||||
|
||||
/* Check that the SDP is sane to start with */
|
||||
ok(pcLocal.localDescription, "pcLocal.localDescription is not null");
|
||||
is(pcLocal.localDescription.type, "offer", "pcLocal.localDescription type is offer");
|
||||
ok(pcLocal.localDescription.sdp.length > 10, "pcLocal.localDescription body length is plausible");
|
||||
|
||||
ok(pcLocal.remoteDescription, "pcLocal.remoteDescription is not null");
|
||||
is(pcLocal.remoteDescription.type, "answer", "pcLocal.remoteDescription type is answer");
|
||||
ok(pcLocal.remoteDescription.sdp.length > 10, "pcLocal.remoteDescription body length is plausible");
|
||||
|
||||
ok(pcRemote.localDescription, "pcRemote.localDescription is not null");
|
||||
is(pcRemote.localDescription.type, "answer", "pcRemote.localDescription type is answer");
|
||||
ok(pcRemote.localDescription.sdp.length > 10, "pcRemote.localDescription body length is plausible");
|
||||
|
||||
ok(pcRemote.remoteDescription, "pcRemote.remoteDescription is not null");
|
||||
is(pcRemote.remoteDescription.type, "offer", "pcRemote.remoteDescription type is offer");
|
||||
ok(pcRemote.remoteDescription.sdp.length > 10, "pcRemote.remoteDescription body length is plausible");
|
||||
|
||||
pcLocal.close();
|
||||
var exception = null;
|
||||
try { description = pcLocal.localDescription; } catch (e) { exception = e; }
|
||||
ok(exception, "attempt to access pcLocal.localDescription after close throws exception");
|
||||
exception = null;
|
||||
try { description = pcLocal.remoteDescription; } catch (e) { exception = e; }
|
||||
ok(exception, "attempt to access pcLocal.remoteDescription after close throws exception");
|
||||
|
||||
pcRemote.close();
|
||||
exception = null;
|
||||
try { description = pcRemote.localDescription; } catch (e) { exception = e; }
|
||||
ok(exception, "attempt to access pcRemote.localDescription after close throws exception");
|
||||
exception = null;
|
||||
try { description = pcRemote.remoteDescription; } catch (e) { exception = e; }
|
||||
ok(exception, "attempt to access pcRemote.remoteDescription after close throws exception");
|
||||
|
||||
SimpleTest.finish();
|
||||
});
|
||||
}, unexpectedCallbackAndFinish);
|
||||
}, unexpectedCallbackAndFinish);
|
||||
});
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user