Bug 1153056 - Fix about:webrtc to not blank on zero allocated PeerConnections. r=jesup, a=sledru
authorJan-Ivar Bruaroey <jib@mozilla.com>
Fri, 10 Apr 2015 08:40:17 -0400
changeset 263204 258c70a0728a6737eda037a2ee27d0c3b7a2c067
parent 263203 952e7fdc34c220bb963af947a32ac8c7d6c61c0a
child 263205 52679d3b56c56da1e43577489707cc7fadeb5a15
push id1963
push userpaolo.mozmail@amadzone.org
push dateSun, 10 May 2015 10:26:20 +0000
reviewersjesup, sledru
bugs1153056
milestone39.0a2
Bug 1153056 - Fix about:webrtc to not blank on zero allocated PeerConnections. r=jesup, a=sledru
media/webrtc/signaling/src/peerconnection/WebrtcGlobalInformation.cpp
--- a/media/webrtc/signaling/src/peerconnection/WebrtcGlobalInformation.cpp
+++ b/media/webrtc/signaling/src/peerconnection/WebrtcGlobalInformation.cpp
@@ -162,41 +162,36 @@ WebrtcGlobalInformation::GetAllStats(
          p != ctx->mPeerConnections.end();
          ++p) {
       MOZ_ASSERT(p->second);
 
       if (!pcIdFilter.WasPassed() ||
           pcIdFilter.Value().EqualsASCII(p->second->GetIdAsAscii().c_str())) {
         if (p->second->HasMedia()) {
           queries->append(nsAutoPtr<RTCStatsQuery>(new RTCStatsQuery(true)));
-          if (NS_WARN_IF(NS_FAILED(p->second->BuildStatsQuery_m(nullptr, // all tracks
-                                                                queries->back())))) {
-            queries->popBack();
-          } else {
-            MOZ_ASSERT(queries->back()->report);
+          rv = p->second->BuildStatsQuery_m(nullptr, queries->back()); // all tracks
+          if (NS_WARN_IF(NS_FAILED(rv))) {
+            aRv.Throw(rv);
+            return;
           }
+          MOZ_ASSERT(queries->back()->report);
         }
       }
     }
   }
 
-  if (!queries->empty()) {
-    // CallbackObject does not support threadsafe refcounting, and must be
-    // destroyed on main.
-    nsMainThreadPtrHandle<WebrtcGlobalStatisticsCallback> callbackHandle(
-      new nsMainThreadPtrHolder<WebrtcGlobalStatisticsCallback>(&aStatsCallback));
+  // CallbackObject does not support threadsafe refcounting, and must be
+  // destroyed on main.
+  nsMainThreadPtrHandle<WebrtcGlobalStatisticsCallback> callbackHandle(
+    new nsMainThreadPtrHolder<WebrtcGlobalStatisticsCallback>(&aStatsCallback));
 
-    rv = RUN_ON_THREAD(stsThread,
-                       WrapRunnableNM(&GetAllStats_s, callbackHandle, queries),
-                       NS_DISPATCH_NORMAL);
-
-    aRv = rv;
-  } else {
-    aRv = NS_OK;
-  }
+  rv = RUN_ON_THREAD(stsThread,
+                     WrapRunnableNM(&GetAllStats_s, callbackHandle, queries),
+                     NS_DISPATCH_NORMAL);
+  aRv = rv;
 }
 
 void
 WebrtcGlobalInformation::GetLogging(
   const GlobalObject& aGlobal,
   const nsAString& aPattern,
   WebrtcGlobalLoggingCallback& aLoggingCallback,
   ErrorResult& aRv)