Bug 1426362 - Display status of policy engine in about:support. r=bytesized

This also changes the const values of nsIEnterprisePolicies to a more common numbering pattern.

MozReview-Commit-ID: CKs1TWGMqJN

--HG--
extra : rebase_source : 117a6587e56ffbe9a10818b93ed42bb8583a4826
This commit is contained in:
Felipe Gomes 2018-03-02 15:28:14 -03:00
parent 08baea01fa
commit 77637dd978
7 changed files with 45 additions and 4 deletions

View File

@ -7,10 +7,10 @@
[scriptable, uuid(6a568972-cc91-4bf5-963e-3768f3319b8a)]
interface nsIEnterprisePolicies : nsISupports
{
const unsigned short UNINITIALIZED = 0;
const unsigned short INACTIVE = 1;
const unsigned short ACTIVE = 2;
const unsigned short FAILED = 3;
const short UNINITIALIZED = -1;
const short INACTIVE = 0;
const short ACTIVE = 1;
const short FAILED = 2;
readonly attribute short status;

View File

@ -101,6 +101,26 @@ var snapshotFormatters = {
`content = ${data.styloResult} (${styloReason}), ` +
`chrome = ${data.styloChromeResult} (${styloChromeReason})`;
if (Services.policies) {
let policiesText = "";
switch (data.policiesStatus) {
case Services.policies.INACTIVE:
policiesText = strings.GetStringFromName("policies.inactive");
break;
case Services.policies.ACTIVE:
policiesText = strings.GetStringFromName("policies.active");
break;
default:
policiesText = strings.GetStringFromName("policies.error");
break;
}
$("policies-status").textContent = policiesText;
} else {
$("policies-status-row").hidden = true;
}
let keyGoogleFound = data.keyGoogleFound ? "found" : "missing";
$("key-google-box").textContent = strings.GetStringFromName(keyGoogleFound);

View File

@ -246,6 +246,15 @@
</td>
</tr>
<tr id="policies-status-row">
<th class="column">
&aboutSupport.enterprisePolicies;
</th>
<td id="policies-status">
</td>
</tr>
<tr>
<th class="column">
&aboutSupport.appBasicsKeyGoogle;

View File

@ -79,6 +79,8 @@ Windows/Mac use the term "Folder" instead of "Directory" -->
<!ENTITY aboutSupport.appBasicsProcessCount "Web Content Processes">
<!ENTITY aboutSupport.enterprisePolicies "Enterprise Policies">
<!ENTITY aboutSupport.appBasicsKeyGoogle "Google Key">
<!ENTITY aboutSupport.appBasicsKeyMozilla "Mozilla Location Service Key">

View File

@ -159,3 +159,8 @@ enabledByDefault = enabled by default
disabledByDefault = disabled by default
enabledByUser = enabled by user
disabledByUser = disabled by user
# LOCALIZATION NOTE Strings representing the status of the Enterprise Policies engine.
policies.inactive = Inactive
policies.active = Active
policies.error = Error

View File

@ -251,6 +251,8 @@ var dataProviders = {
data.styloChromeResult = winUtils.isStyledByServo;
}
data.policiesStatus = Services.policies.status;
const keyGoogle = Services.urlFormatter.formatURL("%GOOGLE_API_KEY%").trim();
data.keyGoogleFound = keyGoogle != "no-google-api-key" && keyGoogle.length > 0;

View File

@ -159,6 +159,9 @@ const SNAPSHOT_SCHEMA = {
styloChromeResult: {
type: "boolean",
},
policiesStatus: {
type: "number",
},
keyGoogleFound: {
type: "boolean",
},