Merge pull request #423 from mahiuchun/master

Fixed getStatsReport
diff --git a/src/web_app/js/stats.js b/src/web_app/js/stats.js
index 0913fb0..d22191a 100644
--- a/src/web_app/js/stats.js
+++ b/src/web_app/js/stats.js
@@ -43,9 +43,9 @@
 // |statName| (if specified), and value |statVal| (if specified). Return
 // undef if not present.
 function getStatsReport(stats, statObj, statName, statVal) {
+  var result = null;
   if (stats) {
-    for (var stat in stats) {
-      var report = stats[stat];
+    stats.forEach(function(report, stat) {
       if (report.type === statObj) {
         var found = true;
         // If |statName| is present, ensure |report| has that stat.
@@ -55,11 +55,12 @@
           found = (statVal !== undefined) ? (val === statVal) : val;
         }
         if (found) {
-          return report;
+          result = report;
         }
       }
-    }
+    });
   }
+  return result;
 }
 
 // Takes two stats reports and determines the rate based on two counter readings