Bug 1647692 - Add language packs and dictionaries to about:support, r=Gijs,fluent-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D80808
This commit is contained in:
Francesco Lodolo (:flod) 2020-06-24 13:30:22 +00:00
parent 6c36ed2c70
commit a4b5e4d9bd
7 changed files with 62 additions and 27 deletions

View File

@ -70,7 +70,7 @@ add_task(async function() {
got = await promiseNewChannelResponse(TEST_URI_GOOD);
// Check some keys we expect to always get.
Assert.ok(got.message.extensions, "should have extensions");
Assert.ok(got.message.addons, "should have addons");
Assert.ok(got.message.graphics, "should have graphics");
// Check we have channel and build ID info:

View File

@ -0,0 +1,20 @@
# coding=utf8
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
from __future__ import absolute_import
from fluent.migrate.helpers import transforms_from
def migrate(ctx):
"""Bug 1647692 - Add language packs and dictionaries to about:support, part {index}."""
ctx.add_transforms(
"toolkit/toolkit/about/aboutSupport.ftl",
"toolkit/toolkit/about/aboutSupport.ftl",
transforms_from("""
support-addons-name = { COPY_PATTERN(from_path, "extensions-name") }
support-addons-version = { COPY_PATTERN(from_path, "extensions-version") }
support-addons-id = { COPY_PATTERN(from_path, "extensions-id") }
""", from_path="toolkit/toolkit/about/aboutSupport.ftl"))

View File

@ -252,15 +252,16 @@ var snapshotFormatters = {
);
},
extensions(data) {
addons(data) {
$.append(
$("extensions-tbody"),
data.map(function(extension) {
$("addons-tbody"),
data.map(function(addon) {
return $.new("tr", [
$.new("td", extension.name),
$.new("td", extension.version),
$.new("td", extension.isActive),
$.new("td", extension.id),
$.new("td", addon.name),
$.new("td", addon.type),
$.new("td", addon.version),
$.new("td", addon.isActive),
$.new("td", addon.id),
]);
})
);

View File

@ -320,18 +320,19 @@
<!-- - - - - - - - - - - - - - - - - - - - - -->
<h2 class="major-section" data-l10n-id="extensions-title"/>
<h2 class="major-section" data-l10n-id="support-addons-title"/>
<table>
<thead>
<tr>
<th data-l10n-id="extensions-name"/>
<th data-l10n-id="extensions-version"/>
<th data-l10n-id="extensions-enabled"/>
<th data-l10n-id="extensions-id"/>
<th data-l10n-id="support-addons-name"/>
<th data-l10n-id="support-addons-type"/>
<th data-l10n-id="support-addons-version"/>
<th data-l10n-id="support-addons-enabled"/>
<th data-l10n-id="support-addons-id"/>
</tr>
</thead>
<tbody id="extensions-tbody">
<tbody id="addons-tbody">
</tbody>
</table>

View File

@ -13,11 +13,12 @@ crashes-id = Report ID
crashes-send-date = Submitted
crashes-all-reports = All Crash Reports
crashes-no-config = This application has not been configured to display crash reports.
extensions-title = Extensions
extensions-name = Name
extensions-enabled = Enabled
extensions-version = Version
extensions-id = ID
support-addons-title = Add-ons
support-addons-name = Name
support-addons-type = Type
support-addons-enabled = Enabled
support-addons-version = Version
support-addons-id = ID
security-software-title = Security Software
security-software-type = Type
security-software-name = Name

View File

@ -286,15 +286,23 @@ var dataProviders = {
done(data);
},
extensions: async function extensions(done) {
let extensions = await AddonManager.getAddonsByTypes(["extension"]);
extensions = extensions.filter(e => !e.isSystem);
extensions.sort(function(a, b) {
addons: async function addons(done) {
let addons = await AddonManager.getAddonsByTypes([
"extension",
"locale",
"dictionary",
]);
addons = addons.filter(e => !e.isSystem);
addons.sort(function(a, b) {
if (a.isActive != b.isActive) {
return b.isActive ? 1 : -1;
}
// In some unfortunate cases addon names can be null.
if (a.type != b.type) {
return a.type.localeCompare(b.type);
}
// In some unfortunate cases add-on names can be null.
let aname = a.name || "";
let bname = b.name || "";
let lc = aname.localeCompare(bname);
@ -306,9 +314,9 @@ var dataProviders = {
}
return 0;
});
let props = ["name", "version", "isActive", "id"];
let props = ["name", "type", "version", "isActive", "id"];
done(
extensions.map(function(ext) {
addons.map(function(ext) {
return props.reduce(function(extData, prop) {
extData[prop] = ext[prop];
return extData;

View File

@ -241,7 +241,7 @@ const SNAPSHOT_SCHEMA = {
},
},
},
extensions: {
addons: {
required: true,
type: "array",
items: {
@ -251,6 +251,10 @@ const SNAPSHOT_SCHEMA = {
required: true,
type: "string",
},
type: {
required: true,
type: "string",
},
version: {
required: true,
type: "string",