Bug 1403585 - React to about:telemetry URL hash after data is present. r=chutten
authorIan Moody <moz-ian@perix.co.uk>
Fri, 29 Sep 2017 18:46:58 +0100
changeset 426858 71ea88d938e5d68c5843a3689b5ddc0fda38a063
parent 426857 f5b35ff6514d486cc116b4640f133ff5c686dc55
child 426859 dda6098cc5161046af377ef69bae69099255b098
push id97
push userfmarier@mozilla.com
push dateSat, 14 Oct 2017 01:12:59 +0000
reviewerschutten
bugs1403585
milestone58.0a1
Bug 1403585 - React to about:telemetry URL hash after data is present. r=chutten Currently if a subsection (for the environment section) is included in the hash on load the page breaks, because urlStateRestore ends up calling showSubSection with no element, which then throws. Move the urlStateRestore call after the update. Also guard against showSubSection receiving an empty argument. MozReview-Commit-ID: 2bYrEQlHlqN
toolkit/content/aboutTelemetry.js
--- a/toolkit/content/aboutTelemetry.js
+++ b/toolkit/content/aboutTelemetry.js
@@ -1984,16 +1984,19 @@ function show(selected) {
 
   adjustHeaderState();
   displayProcessesSelector(selectedValue);
   adjustSearchState();
   changeUrlPath(selectedValue);
 }
 
 function showSubSection(selected) {
+  if (!selected) {
+    return;
+  }
   let current_selection = document.querySelector(".category-subsection.selected");
   if (current_selection)
     current_selection.classList.remove("selected");
   selected.classList.add("selected");
 
   let section = document.getElementById(selected.getAttribute("value"));
   section.parentElement.childNodes.forEach((element) => {
     element.hidden = true;
@@ -2156,18 +2159,18 @@ function onLoad() {
 
   // Render settings.
   Settings.render();
 
   adjustHeaderState();
 
   // Update ping data when async Telemetry init is finished.
   Telemetry.asyncFetchTelemetryData(async () => {
+    await PingPicker.update();
     urlStateRestore();
-    await PingPicker.update();
   });
 }
 
 var LateWritesSingleton = {
   renderHeader: function LateWritesSingleton_renderHeader(aIndex) {
     StackRenderer.renderHeader("late-writes", [aIndex + 1]);
   },