bug 1396894 - Don't error out when rendering normally-structured pings r=Dexter
authorChris H-C <chutten@mozilla.com>
Tue, 05 Sep 2017 14:37:06 -0400
changeset 428678 378fb92460390fd280fbac4afdb7b3d91a027d7c
parent 428677 adba302ab807e36ee451eb944496b83de55ca053
child 428679 265d819ddd783ca209dff441da66c658cdcb34fc
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersDexter
bugs1396894
milestone57.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 1396894 - Don't error out when rendering normally-structured pings r=Dexter Acceptably-structured pings should render fine in about:telemetry and not trigger the panic mode of "Just show them the JSON!" that happens when an exception is thrown. Two things caught here: 1: Environment section without addon subsection 2: subsection searches MozReview-Commit-ID: 3Z0hud23XuD
toolkit/content/aboutTelemetry.js
--- a/toolkit/content/aboutTelemetry.js
+++ b/toolkit/content/aboutTelemetry.js
@@ -657,16 +657,19 @@ var EnvironmentData = {
 
   appendAddonSubsectionTitle(section, table) {
     let caption = document.createElement("caption");
     caption.appendChild(document.createTextNode(section));
     table.appendChild(caption);
   },
 
   createAddonSection(dataDiv, ping) {
+    if (!ping || !("environment" in ping) || !("addons" in ping.environment)) {
+      return;
+    }
     let addonSection = document.createElement("div");
     addonSection.setAttribute("class", "subsection-data subdata");
     let addons = ping.environment.addons;
     this.renderAddonsObject(addons.activeAddons, addonSection, "activeAddons");
     this.renderActivePlugins(addons.activePlugins, addonSection, "activePlugins");
     this.renderKeyValueObject(addons.theme, addonSection, "theme");
     this.renderKeyValueObject(addons.activeExperiment, addonSection, "activeExperiment");
     this.renderAddonsObject(addons.activeGMPlugins, addonSection, "activeGMPlugins");
@@ -1394,17 +1397,17 @@ var Search = {
         keyedElements.push({key, datas});
       }
       noSearchResults = this.filterKeyedElements(keyedElements, text);
     } else if (section.querySelector(".sub-section")) {
       let keyedSubSections = [];
       let subsections = section.querySelectorAll(".sub-section");
       for (let section of subsections) {
         let datas = section.querySelector("table").rows
-        keyedSubSections.push({section, datas});
+        keyedSubSections.push({key: section, datas});
       }
       noSearchResults = this.filterKeyedElements(keyedSubSections, text);
     } else {
       let tables = section.querySelectorAll("table");
       for (let table of tables) {
         noSearchResults = this.filterElements(table.rows, text);
         if (table.caption) {
           table.caption.hidden = noSearchResults;