Bug 1538188 - display '—' instead of garbage in the tooltip when there's no previous sample for a tab, r=zbraniecki.
authorFlorian Quèze <florian@queze.net>
Fri, 22 Mar 2019 16:38:37 +0000
changeset 465729 8b4f4d15c0f3871b3cfc9b5adf57073b2789fd6b
parent 465728 81ecd35d0a7dbce2ddce93c1c6520c2300332c08
child 465730 ae7a26049a6c8e46b5a80c0cdbe9b7125219e1c9
push id1
push userpvanderbeken@mozilla.com
push dateThu, 28 Mar 2019 13:34:35 +0000
reviewerszbraniecki
bugs1538188
milestone68.0a1
Bug 1538188 - display '—' instead of garbage in the tooltip when there's no previous sample for a tab, r=zbraniecki. Differential Revision: https://phabricator.services.mozilla.com/D24504
toolkit/components/aboutperformance/content/aboutPerformance.js
--- a/toolkit/components/aboutperformance/content/aboutPerformance.js
+++ b/toolkit/components/aboutperformance/content/aboutPerformance.js
@@ -465,18 +465,24 @@ var View = {
           memory = Math.ceil(memory / 1024 * 100) / 100;
           unit = "GB";
         }
       }
       document.l10n.setAttributes(elt, "size-" + unit, {value: memory});
     }
     row.appendChild(elt);
 
-    if (tooltip)
+    if (tooltip) {
+      for (let key of ["dispatchesSincePrevious", "durationSincePrevious"]) {
+        if (Number.isNaN(tooltip[key]) || tooltip[key] < 0) {
+          tooltip[key] = "–";
+        }
+      }
       document.l10n.setAttributes(row, "item", tooltip);
+    }
 
     elt = document.createElement("td");
     if (type == "tab") {
       let img = document.createElement("span");
       img.className = "action-icon close-icon";
       document.l10n.setAttributes(img, "close-tab");
       elt.appendChild(img);
     } else if (type == "addon") {