From bed2514c459c6442d0e808fb489cca1e41dacd90 Mon Sep 17 00:00:00 2001 From: Sebastian Hengst Date: Sat, 9 May 2015 10:34:24 +0200 Subject: [PATCH] Backed out changeset 899c470e0275 (bug 1087551) for build bustage. r=bustage fix for CLOSED TREE --- dom/media/tests/mochitest/mochitest.ini | 2 +- dom/media/tests/mochitest/pc.js | 27 +++++---- ...nnection_addCandidateInHaveLocalOffer.html | 58 +++---------------- .../test_peerConnection_errorCallbacks.html | 11 ++++ .../signaling/src/jsep/JsepSessionImpl.cpp | 6 +- 5 files changed, 37 insertions(+), 67 deletions(-) diff --git a/dom/media/tests/mochitest/mochitest.ini b/dom/media/tests/mochitest/mochitest.ini index ef497f1eb66..d855ddf8af1 100644 --- a/dom/media/tests/mochitest/mochitest.ini +++ b/dom/media/tests/mochitest/mochitest.ini @@ -67,7 +67,7 @@ skip-if = toolkit == 'gonk' || buildapp == 'mulet' || toolkit == 'android' # Bug skip-if = toolkit == 'gonk' || buildapp == 'mulet' || toolkit == 'android' # Bug 1063290, intermittent timeout [test_getUserMedia_peerIdentity.html] skip-if = toolkit == 'gonk' || buildapp == 'mulet' # b2g(Bug 1021776, too --ing slow on b2g) -[test_peerConnection_addIceCandidate.html] +[test_peerConnection_addCandidateInHaveLocalOffer.html] skip-if = toolkit == 'gonk' || buildapp == 'mulet' # b2g (Bug 1059867) [test_peerConnection_basicAudio.html] skip-if = toolkit == 'gonk' || buildapp == 'mulet' # b2g (Bug 1059867) diff --git a/dom/media/tests/mochitest/pc.js b/dom/media/tests/mochitest/pc.js index c70d1147b99..0db0d537ef2 100644 --- a/dom/media/tests/mochitest/pc.js +++ b/dom/media/tests/mochitest/pc.js @@ -1204,18 +1204,21 @@ PeerConnectionWrapper.prototype = { return; } this.holdIceCandidates.then(() => { - info(this + ": adding ICE candidate " + JSON.stringify(candidate)); - return this._pc.addIceCandidate(candidate); - }) - .then(() => ok(true, this + " successfully added an ICE candidate")) - .catch(e => - // The onicecandidate callback runs independent of the test steps - // and therefore errors thrown from in there don't get caught by the - // race of the Promises around our test steps. - // Note: as long as we are queuing ICE candidates until the success - // of sRD() this should never ever happen. - ok(false, this + " adding ICE candidate failed with: " + e.message) - ); + this.addIceCandidate(candidate); + }); + }, + + /** + * Adds an ICE candidate and automatically handles the failure case. + * + * @param {object} candidate + * SDP candidate + */ + addIceCandidate : function(candidate) { + info(this + ": adding ICE candidate " + JSON.stringify(candidate)); + return this._pc.addIceCandidate(candidate).then(() => { + info(this + ": Successfully added an ICE candidate"); + }); }, /** diff --git a/dom/media/tests/mochitest/test_peerConnection_addCandidateInHaveLocalOffer.html b/dom/media/tests/mochitest/test_peerConnection_addCandidateInHaveLocalOffer.html index 1f0f2f2a0f4..9a8c5cb748a 100644 --- a/dom/media/tests/mochitest/test_peerConnection_addCandidateInHaveLocalOffer.html +++ b/dom/media/tests/mochitest/test_peerConnection_addCandidateInHaveLocalOffer.html @@ -7,21 +7,21 @@
 
diff --git a/dom/media/tests/mochitest/test_peerConnection_errorCallbacks.html b/dom/media/tests/mochitest/test_peerConnection_errorCallbacks.html
index 845e72fc0ee..8c638c25ef4 100644
--- a/dom/media/tests/mochitest/test_peerConnection_errorCallbacks.html
+++ b/dom/media/tests/mochitest/test_peerConnection_errorCallbacks.html
@@ -42,6 +42,16 @@
           validateReason);
   };
 
+  function testAddIceCandidateError() {
+    var pc = new mozRTCPeerConnection();
+    info ("Testing addIceCandidate error");
+    return pc.addIceCandidate(new mozRTCIceCandidate({ candidate: "Pony Lords, jump!",
+                                                       sdpMid: "whee",
+                                                       sdpMLineIndex: 1 }))
+    .then(generateErrorCallback("addIceCandidate with nonsense candidate should fail"),
+          validateReason);
+  };
+
   // No test for createOffer errors -- there's nothing we can do at this
   // level to evoke an error in createOffer.
 
@@ -49,6 +59,7 @@
     testCreateAnswerError()
     .then(testSetLocalDescriptionError)
     .then(testSetRemoteDescriptionError)
+    .then(testAddIceCandidateError)
     .catch(reason => ok(false, "unexpected error: " + reason))
     .then(networkTestFinished);
   });
diff --git a/media/webrtc/signaling/src/jsep/JsepSessionImpl.cpp b/media/webrtc/signaling/src/jsep/JsepSessionImpl.cpp
index a185c8cea7c..4bf138f148d 100644
--- a/media/webrtc/signaling/src/jsep/JsepSessionImpl.cpp
+++ b/media/webrtc/signaling/src/jsep/JsepSessionImpl.cpp
@@ -2462,11 +2462,11 @@ JsepSessionImpl::AddCandidateToSdp(Sdp* sdp,
 {
 
   if (level >= sdp->GetMediaSectionCount()) {
-    JSEP_SET_ERROR("Index " << level << " out of range");
-    return NS_ERROR_INVALID_ARG;
+    // Ignore
+    return NS_OK;
   }
 
-  // Trim off '[a=]candidate:'
+  // Trim off a=candidate:
   size_t begin = candidateUntrimmed.find(':');
   if (begin == std::string::npos) {
     JSEP_SET_ERROR("Invalid candidate, no ':' (" << candidateUntrimmed << ")");