Bug 1418522 - fix unmatched ICE candidate handling on about:webrtc. r=ng
authorMichael Froman <mfroman@mozilla.com>
Fri, 17 Nov 2017 17:08:00 -0600
changeset 392795 ff6ab6ec5d185be0a27a7779dbf82e991fe4de59
parent 392794 82ea4b82a7fa6fe300c86f2306a8b803087f78eb
child 392796 5f6fb7f92a7cf07c18a02c0f3ca12d65d8a40bcd
push id97527
push usertoros@mozilla.com
push dateTue, 21 Nov 2017 10:20:05 +0000
treeherdermozilla-inbound@60d0f3ee0c43 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersng
bugs1418522
milestone59.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1418522 - fix unmatched ICE candidate handling on about:webrtc. r=ng MozReview-Commit-ID: 4cbxgJw9xIF
toolkit/content/aboutwebrtc/aboutWebrtc.js
--- a/toolkit/content/aboutwebrtc/aboutWebrtc.js
+++ b/toolkit/content/aboutwebrtc/aboutWebrtc.js
@@ -660,18 +660,18 @@ function ICEStats(report) {
   this._report = report;
 }
 
 ICEStats.prototype = {
   render() {
     let tbody = [];
     for (let stat of this.generateICEStats()) {
       tbody.push([
-        stat.localcandidate || "",
-        stat.remotecandidate || "",
+        stat["local-candidate"] || "",
+        stat["remote-candidate"] || "",
         stat.state || "",
         stat.priority || "",
         stat.nominated || "",
         stat.selected || "",
         stat.bytesSent || "",
         stat.bytesReceived || ""
       ]);
     }
@@ -728,42 +728,38 @@ ICEStats.prototype = {
     let stat;
 
     for (let pair of this._report.iceCandidatePairStats) {
       let local = candidates.get(pair.localCandidateId);
       let remote = candidates.get(pair.remoteCandidateId);
 
       if (local) {
         stat = {
-          localcandidate: this.candidateToString(local),
+          ["local-candidate"]: this.candidateToString(local),
           state: pair.state,
           priority: pair.priority,
           nominated: pair.nominated,
           selected: pair.selected,
           bytesSent: pair.bytesSent,
           bytesReceived: pair.bytesReceived
         };
         matched[local.id] = true;
 
         if (remote) {
-          stat.remotecandidate = this.candidateToString(remote);
+          stat["remote-candidate"] = this.candidateToString(remote);
           matched[remote.id] = true;
         }
         stats.push(stat);
       }
     }
 
-    for (let c of candidates.values()) {
-      if (matched[c.id])
-        continue;
-
-      stat = {};
-      stat[c.type] = this.candidateToString(c);
-      stats.push(stat);
-    }
+    // add the unmatched candidates to the end of the table
+    [...candidates.values()].filter(cand => !matched[cand.id]).forEach(
+      cand => stats.push({[cand.type]: this.candidateToString(cand)})
+    );
 
     return stats.sort((a, b) => (b.priority || 0) - (a.priority || 0));
   },
 
   candidateToString(c) {
     if (!c) {
       return "*";
     }