From f8c4280718ec768efad9a6bded20c0fdd8439a39 Mon Sep 17 00:00:00 2001 From: Gregg Lind Date: Thu, 20 Mar 2014 11:19:19 -0400 Subject: [PATCH] Bug 981842 - Show details about current and past teleemtry experiments in about:support, r=bsmedberg --- toolkit/content/aboutSupport.js | 15 ++++++++++++++ toolkit/content/aboutSupport.xhtml | 33 ++++++++++++++++++++++++++++++ toolkit/modules/Troubleshoot.jsm | 19 +++++++++++++++++ 3 files changed, 67 insertions(+) diff --git a/toolkit/content/aboutSupport.js b/toolkit/content/aboutSupport.js index dae1e1c97849..f5a70cbc0422 100644 --- a/toolkit/content/aboutSupport.js +++ b/toolkit/content/aboutSupport.js @@ -111,6 +111,21 @@ let snapshotFormatters = { })); }, + experiments: function experiments(data) { + $.append($("experiments-tbody"), data.map(function (experiment) { + return $.new("tr", [ + $.new("td", experiment.name), + $.new("td", experiment.id), + $.new("td", experiment.description), + $.new("td", experiment.active), + $.new("td", experiment.endDate), + $.new("td", [ + $.new("a", experiment.detailURL, null, {href : experiment.detailURL,}) + ]), + ]); + })); + }, + modifiedPreferences: function modifiedPreferences(data) { $.append($("prefs-tbody"), sortedArrayFromObject(data).map( function ([name, value]) { diff --git a/toolkit/content/aboutSupport.xhtml b/toolkit/content/aboutSupport.xhtml index 1844fb56ba2f..3fb1765af654 100644 --- a/toolkit/content/aboutSupport.xhtml +++ b/toolkit/content/aboutSupport.xhtml @@ -317,6 +317,39 @@ + +

+ &aboutSupport.experimentsTitle; +

+ + + + + + + + + + + + + + +
+ &aboutSupport.experimentName; + + &aboutSupport.experimentId; + + &aboutSupport.experimentDescription; + + &aboutSupport.experimentActive; + + &aboutSupport.experimentEndDate; + + &aboutSupport.experimentHomepage; +
+ + diff --git a/toolkit/modules/Troubleshoot.jsm b/toolkit/modules/Troubleshoot.jsm index 02387d343049..1d72f5f552d5 100644 --- a/toolkit/modules/Troubleshoot.jsm +++ b/toolkit/modules/Troubleshoot.jsm @@ -15,6 +15,13 @@ Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/CrashReports.jsm"); #endif +let Experiments; +try { + Experiments = Cu.import("resource:///modules/experiments/Experiments.jsm").Experiments; +} +catch (e) { +} + // We use a preferences whitelist to make sure we only show preferences that // are useful for support and won't compromise the user's privacy. Note that // entries are *prefixes*: for example, "accessibility." applies to all prefs @@ -174,6 +181,18 @@ let dataProviders = { }); }, + experiments: function experiments(done) { + if (Experiments === undefined) { + done([]); + return; + } + + // getExperiments promises experiment history + Experiments.instance().getExperiments().then( + experiments => done(experiments) + ); + }, + modifiedPreferences: function modifiedPreferences(done) { function getPref(name) { let table = {};