Closed Bug 1363828 Opened 6 years ago Closed 6 years ago

Make about:telemetry more exception-safe


(Toolkit :: Telemetry, defect, P3)




Tracking Status
firefox55 --- fixed


(Reporter: gfritzsche, Assigned: flyingrub, Mentored)



(Whiteboard: [lang=js])


(2 files)

Per bug 1363759, a missing addons section in a ping is breaking the whole about:telemetry page.

In displayPingData() [1], we should make sure to catch errors from any of the renderers.
If any of them fail we should still be able to:
- show the raw data
- not break the top-level controls

> STR:
> Run a build with an active SHIELD experiment
> Quit the build
> Run it again
> Visit about:telemetry
> Choose "Archived Ping Data"
> Actual:
> Archived ping data is broken and there is no selector for an archived ping to load
> Message in the JS console: TypeError: addons is undefined[Learn More]  aboutTelemetry.js:720:5
> This is
> I loaded the ping by hand using TelemetryArchive, and it's a shield-study ping. This ping has an environment section, but no addons block. I'm going to attach the entire ping contents.
> ...
> * unexpected exceptions in aboutTelemetry.js rendering shouldn't affect the history view or prevent me from at least viewing the raw data

flyingrub, would you be interested in taking this?
Flags: needinfo?(flyinggrub)
It seems to totally fit the about:telemetry redesign.

I'm taking it. :)
Flags: needinfo?(flyinggrub)
Assignee: nobody → flyinggrub
Comment on attachment 8871774 [details]
Bug 1363828 - Replace custom isArray() by Array.isArray()

Did you run this through the linter to make sure it's clean? (It probably is)

`mach lint toolkit/components/telemetry`
Attachment #8871774 - Flags: review?(chutten) → review+
I just tried to run it with `./mach lint toolkit/content/aboutTelemetry.js` (it's the only file I changed) and it went fine.
Comment on attachment 8871816 [details]
Bug 1363828 - First attempt at making about:telemetry more exception

::: toolkit/content/aboutTelemetry.js:2087
(Diff revision 1)
>    // Render raw ping data.
>    let pre = document.getElementById("raw-ping-data");
>    pre.textContent = JSON.stringify(gPingData, null, 2);
> +  try {
> +    tryDdisplayPingData(ping, updatePayloadList);

Ugh. Naming things is hard.

Maybe call it `displayRichPingData` or something that calls out that it's only doing the "fancy" stuff?

::: toolkit/content/aboutTelemetry.js:2093
(Diff revision 1)
> +  } catch (err) {
> +    PingPicker._showRawPingData();
> +  }
> +}
> +
> +function tryDdisplayPingData(ping, updatePayloadList = false) {

This doesn't require a default value as it will always have a value.
Attachment #8871816 - Flags: review?(chutten) → review-
Comment on attachment 8871816 [details]
Bug 1363828 - First attempt at making about:telemetry more exception

This brings up an interesting question for the redesign:

What should we do if something goes wrong? Should we log to console? Show something to the user? 

The current aboutTelemetry.js just swallows known errors.

Something to think about.
Attachment #8871816 - Flags: review?(chutten) → review+
Is this all the work necessary for this bug? If so, we can start landing these.
Keywords: checkin-needed
Pushed by
Replace custom isArray() by Array.isArray() r=chutten
First attempt at making about:telemetry more exception r=chutten
Keywords: checkin-needed
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
Blocks: 1384534
You need to log in before you can comment on or make changes to this bug.