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
--- a/toolkit/components/enterprisepolicies/nsIEnterprisePolicies.idl
+++ b/toolkit/components/enterprisepolicies/nsIEnterprisePolicies.idl
@@ -2,17 +2,17 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsISupports.idl"
[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;
bool isAllowed(in ACString feature);
};
--- a/toolkit/content/aboutSupport.js
+++ b/toolkit/content/aboutSupport.js
@@ -96,16 +96,36 @@ var snapshotFormatters = {
data.styloChromeDefault);
}
styloReason = strings.GetStringFromName(styloReason);
styloChromeReason = strings.GetStringFromName(styloChromeReason);
$("stylo-box").textContent =
`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);
let keyMozillaFound = data.keyMozillaFound ? "found" : "missing";
$("key-mozilla-box").textContent = strings.GetStringFromName(keyMozillaFound);
$("safemode-box").textContent = data.safeMode;
},
--- a/toolkit/content/aboutSupport.xhtml
+++ b/toolkit/content/aboutSupport.xhtml
@@ -241,16 +241,25 @@
<th class="column">
Stylo
</th>
<td id="stylo-box">
</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;
</th>
<td id="key-google-box">
</td>
</tr>
--- a/toolkit/locales/en-US/chrome/global/aboutSupport.dtd
+++ b/toolkit/locales/en-US/chrome/global/aboutSupport.dtd
@@ -74,16 +74,18 @@ Windows/Mac use the term "Folder" instea
<!ENTITY aboutSupport.appBasicsServiceWorkers "Registered Service Workers">
<!ENTITY aboutSupport.appBasicsProfiles "Profiles">
<!ENTITY aboutSupport.appBasicsMultiProcessSupport "Multiprocess Windows">
<!ENTITY aboutSupport.appBasicsProcessCount "Web Content Processes">
+<!ENTITY aboutSupport.enterprisePolicies "Enterprise Policies">
+
<!ENTITY aboutSupport.appBasicsKeyGoogle "Google Key">
<!ENTITY aboutSupport.appBasicsKeyMozilla "Mozilla Location Service Key">
<!ENTITY aboutSupport.appBasicsSafeMode "Safe Mode">
<!ENTITY aboutSupport.showDir.label "Open Directory">
<!-- LOCALIZATION NOTE (aboutSupport.showMac.label): This is the Mac-specific
variant of aboutSupport.showDir.label. This allows us to use the preferred
--- a/toolkit/locales/en-US/chrome/global/aboutSupport.properties
+++ b/toolkit/locales/en-US/chrome/global/aboutSupport.properties
@@ -154,8 +154,13 @@ wheelWarning = async wheel input disable
touchWarning = async touch input disabled due to unsupported pref: %S
# LOCALIZATION NOTE Strings explaining why a feature is or is not available.
disabledByBuild = disabled by build
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
--- a/toolkit/modules/Troubleshoot.jsm
+++ b/toolkit/modules/Troubleshoot.jsm
@@ -246,16 +246,18 @@ var dataProviders = {
data.styloChromeResult = false;
if (data.styloResult) {
let winUtils = Services.wm.getMostRecentWindow("").
QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIDOMWindowUtils);
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;
const keyMozilla = Services.urlFormatter.formatURL("%MOZILLA_API_KEY%").trim();
data.keyMozillaFound = keyMozilla != "no-mozilla-api-key" && keyMozilla.length > 0;
done(data);
},
--- a/toolkit/modules/tests/browser/browser_Troubleshoot.js
+++ b/toolkit/modules/tests/browser/browser_Troubleshoot.js
@@ -154,16 +154,19 @@ const SNAPSHOT_SCHEMA = {
type: "boolean",
},
styloChromeDefault: {
type: "boolean",
},
styloChromeResult: {
type: "boolean",
},
+ policiesStatus: {
+ type: "number",
+ },
keyGoogleFound: {
type: "boolean",
},
keyMozillaFound: {
type: "boolean",
},
safeMode: {
type: "boolean",