Bug 1363828 - First attempt at making about:telemetry more exception draft
authorflyingrub <flyinggrub@gmail.com>
Fri, 26 May 2017 18:15:22 +0200
changeset 585184 e2448ec68a55c518a8e3554409f4c1b02aef7173
parent 585114 6019f5a26f9e38b755a63b52c46f2eccf878dc30
child 630660 848d984e67bca5fa1ead36d06ae5f9bcfe424be2
push id61041
push userbmo:flyinggrub@gmail.com
push dateFri, 26 May 2017 16:50:32 +0000
bugs1363828
milestone55.0a1
Bug 1363828 - First attempt at making about:telemetry more exception safe We could also test ping.environment.addons before using it. MozReview-Commit-ID: 1z6NdLPTBqN
toolkit/content/aboutTelemetry.js
--- a/toolkit/content/aboutTelemetry.js
+++ b/toolkit/content/aboutTelemetry.js
@@ -102,17 +102,16 @@ function filterObject(obj, filterOut) {
   for (let k of Object.keys(obj)) {
     if (filterOut.indexOf(k) == -1) {
       ret[k] = obj[k];
     }
   }
   return ret;
 }
 
-
 /**
  * This turns a JSON object into a "flat" stringified form, separated into top-level sections.
  *
  * For an object like:
  *   {
  *     a: {b: "1"},
  *     c: {d: "2", e: {f: "3"}}
  *   }
@@ -2079,16 +2078,24 @@ function togglePingSections(isMainPing) 
 
 function displayPingData(ping, updatePayloadList = false) {
   gPingData = ping;
 
   // Render raw ping data.
   let pre = document.getElementById("raw-ping-data");
   pre.textContent = JSON.stringify(gPingData, null, 2);
 
+  try {
+    displayRichPingData(ping, updatePayloadList);
+  } catch (err) {
+    PingPicker._showRawPingData();
+  }
+}
+
+function displayRichPingData(ping, updatePayloadList) {
   // Update the structured data rendering.
   const keysHeader = bundle.GetStringFromName("keysHeader");
   const valuesHeader = bundle.GetStringFromName("valuesHeader");
 
   // Update the payload list and process lists
   if (updatePayloadList) {
     renderPayloadList(ping);
     renderProcessList(ping, document.getElementById("scalars-processes"));