Bug 1308981: Display system add-ons in a separate section in about:support. draft
authorDave Townsend <dtownsend@oxymoronical.com>
Thu, 09 Mar 2017 15:44:40 -0800
changeset 496207 af8d11916a39e36fa341652491d70daee2b71ae3
parent 494215 fde4cd0aed6deccd27113ad6519ad31d5f27564a
child 548575 b4817260a52b1bca4672422de87e14d0c79ebbc8
push id48556
push userdtownsend@mozilla.com
push dateThu, 09 Mar 2017 23:46:52 +0000
bugs1308981
milestone54.0a1
Bug 1308981: Display system add-ons in a separate section in about:support. MozReview-Commit-ID: 3KYFz4pOXPT
toolkit/content/aboutSupport.js
toolkit/content/aboutSupport.xhtml
toolkit/locales/en-US/chrome/global/aboutSupport.dtd
toolkit/modules/Troubleshoot.jsm
toolkit/modules/tests/browser/browser_Troubleshoot.js
--- a/toolkit/content/aboutSupport.js
+++ b/toolkit/content/aboutSupport.js
@@ -147,16 +147,26 @@ var snapshotFormatters = {
         $.new("td", extension.name),
         $.new("td", extension.version),
         $.new("td", extension.isActive),
         $.new("td", extension.id),
       ]);
     }));
   },
 
+  features: function features(data) {
+    $.append($("features-tbody"), data.map(function(feature) {
+      return $.new("tr", [
+        $.new("td", feature.name),
+        $.new("td", feature.version),
+        $.new("td", feature.id),
+      ]);
+    }));
+  },
+
   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),
--- a/toolkit/content/aboutSupport.xhtml
+++ b/toolkit/content/aboutSupport.xhtml
@@ -295,16 +295,40 @@
         <a href="about:crashes" id="crashes-allReportsWithPending" class="block">&aboutSupport.crashes.allReports;</a>
       </p>
       <p id="crashes-noConfig" class="hidden no-copy">&aboutSupport.crashes.noConfig;</p>
 
 #endif
       <!-- - - - - - - - - - - - - - - - - - - - - -->
 
       <h2 class="major-section">
+        &aboutSupport.featuresTitle;
+      </h2>
+
+      <table>
+        <thead>
+          <tr>
+            <th>
+              &aboutSupport.featureName;
+            </th>
+            <th>
+              &aboutSupport.featureVersion;
+            </th>
+            <th>
+              &aboutSupport.featureId;
+            </th>
+          </tr>
+        </thead>
+        <tbody id="features-tbody">
+        </tbody>
+      </table>
+
+      <!-- - - - - - - - - - - - - - - - - - - - - -->
+
+      <h2 class="major-section">
         &aboutSupport.extensionsTitle;
       </h2>
 
       <table>
         <thead>
           <tr>
             <th>
               &aboutSupport.extensionName;
--- a/toolkit/locales/en-US/chrome/global/aboutSupport.dtd
+++ b/toolkit/locales/en-US/chrome/global/aboutSupport.dtd
@@ -20,16 +20,21 @@ This is likely the same like id.heading 
 <!ENTITY aboutSupport.crashes.noConfig "This application has not been configured to display crash reports.">
 
 <!ENTITY aboutSupport.extensionsTitle "Extensions">
 <!ENTITY aboutSupport.extensionName "Name">
 <!ENTITY aboutSupport.extensionEnabled "Enabled">
 <!ENTITY aboutSupport.extensionVersion "Version">
 <!ENTITY aboutSupport.extensionId "ID">
 
+<!ENTITY aboutSupport.featuresTitle "&brandShortName; Features">
+<!ENTITY aboutSupport.featureName "Name">
+<!ENTITY aboutSupport.featureVersion "Version">
+<!ENTITY aboutSupport.featureId "ID">
+
 <!ENTITY aboutSupport.experimentsTitle "Experimental Features">
 <!ENTITY aboutSupport.experimentName "Name">
 <!ENTITY aboutSupport.experimentId "ID">
 <!ENTITY aboutSupport.experimentDescription "Description">
 <!ENTITY aboutSupport.experimentActive "Active">
 <!ENTITY aboutSupport.experimentEndDate "End Date">
 <!ENTITY aboutSupport.experimentHomepage "Homepage">
 <!ENTITY aboutSupport.experimentBranch "Branch">
--- a/toolkit/modules/Troubleshoot.jsm
+++ b/toolkit/modules/Troubleshoot.jsm
@@ -236,16 +236,17 @@ var dataProviders = {
     const keyMozilla = Services.urlFormatter.formatURL("%MOZILLA_API_KEY%").trim();
     data.keyMozillaFound = keyMozilla != "no-mozilla-api-key" && keyMozilla.length > 0;
 
     done(data);
   },
 
   extensions: function extensions(done) {
     AddonManager.getAddonsByTypes(["extension"], function(extensions) {
+      extensions = extensions.filter(e => !e.isSystem);
       extensions.sort(function(a, b) {
         if (a.isActive != b.isActive)
           return b.isActive ? 1 : -1;
 
         // In some unfortunate cases addon names can be null.
         let aname = a.name || null;
         let bname = b.name || null;
         let lc = aname.localeCompare(bname);
@@ -260,16 +261,40 @@ var dataProviders = {
         return props.reduce(function(extData, prop) {
           extData[prop] = ext[prop];
           return extData;
         }, {});
       }));
     });
   },
 
+  features: function features(done) {
+    AddonManager.getAddonsByTypes(["extension"], function(features) {
+      features = features.filter(f => f.isSystem);
+      features.sort(function(a, b) {
+        // In some unfortunate cases addon names can be null.
+        let aname = a.name || null;
+        let bname = b.name || null;
+        let lc = aname.localeCompare(bname);
+        if (lc != 0)
+          return lc;
+        if (a.version != b.version)
+          return a.version > b.version ? 1 : -1;
+        return 0;
+      });
+      let props = ["name", "version", "id"];
+      done(features.map(function(f) {
+        return props.reduce(function(fData, prop) {
+          fData[prop] = f[prop];
+          return fData;
+        }, {});
+      }));
+    });
+  },
+
   experiments: function experiments(done) {
     if (Experiments === undefined) {
       done([]);
       return;
     }
 
     // getExperiments promises experiment history
     Experiments.instance().getExperiments().then(
--- a/toolkit/modules/tests/browser/browser_Troubleshoot.js
+++ b/toolkit/modules/tests/browser/browser_Troubleshoot.js
@@ -200,16 +200,37 @@ const SNAPSHOT_SCHEMA = {
           },
           isActive: {
             required: true,
             type: "boolean",
           },
         },
       },
     },
+    features: {
+      required: true,
+      type: "array",
+      items: {
+        type: "object",
+        properties: {
+          name: {
+            required: true,
+            type: "string",
+          },
+          version: {
+            required: true,
+            type: "string",
+          },
+          id: {
+            required: true,
+            type: "string",
+          },
+        },
+      },
+    },
     modifiedPreferences: {
       required: true,
       type: "object",
     },
     lockedPreferences: {
       required: true,
       type: "object",
     },