Bug 804430 - Add list of whitelisted locked prefs to about:support. r=Unfocused

This commit is contained in:
Bernardo P. Rittmeyer 2014-06-10 10:49:00 -04:00
parent 33f7ee00f8
commit 9b1437e391
5 changed files with 61 additions and 0 deletions

View File

@ -148,6 +148,17 @@ let snapshotFormatters = {
));
},
lockedPreferences: function lockedPreferences(data) {
$.append($("locked-prefs-tbody"), sortedArrayFromObject(data).map(
function ([name, value]) {
return $.new("tr", [
$.new("td", name, "pref-name"),
$.new("td", String(value).substr(0, 120), "pref-value"),
]);
}
));
},
graphics: function graphics(data) {
// graphics-info-properties tbody
if ("info" in data) {

View File

@ -263,6 +263,27 @@
<p>&aboutSupport.userJSDescription;</p>
</section>
<!-- - - - - - - - - - - - - - - - - - - - - -->
<h2 class="major-section">
&aboutSupport.lockedKeyPrefsTitle;
</h2>
<table class="prefs-table">
<thead class="no-copy">
<th class="name">
&aboutSupport.lockedPrefsName;
</th>
<th class="value">
&aboutSupport.lockedPrefsValue;
</th>
</thead>
<tbody id="locked-prefs-tbody">
</tbody>
</table>
<!-- - - - - - - - - - - - - - - - - - - - - -->
<h2 class="major-section">
&aboutSupport.jsTitle;

View File

@ -71,6 +71,10 @@ variant of aboutSupport.showDir.label. -->
<!ENTITY aboutSupport.userJSTitle "user.js Preferences">
<!ENTITY aboutSupport.userJSDescription "Your profile folder contains a <a id='prefs-user-js-link'>user.js file</a>, which includes preferences that were not created by &brandShortName;.">
<!ENTITY aboutSupport.lockedKeyPrefsTitle "Important Locked Preferences">
<!ENTITY aboutSupport.lockedPrefsName "Name">
<!ENTITY aboutSupport.lockedPrefsValue "Value">
<!ENTITY aboutSupport.graphicsTitle "Graphics">
<!ENTITY aboutSupport.jsTitle "JavaScript">

View File

@ -214,6 +214,27 @@ let dataProviders = {
}, {}));
},
lockedPreferences: function lockedPreferences(done) {
function getPref(name) {
let table = {};
table[Ci.nsIPrefBranch.PREF_STRING] = "getCharPref";
table[Ci.nsIPrefBranch.PREF_INT] = "getIntPref";
table[Ci.nsIPrefBranch.PREF_BOOL] = "getBoolPref";
let type = Services.prefs.getPrefType(name);
if (!(type in table))
throw new Error("Unknown preference type " + type + " for " + name);
return Services.prefs[table[type]](name);
}
done(PREFS_WHITELIST.reduce(function (prefs, branch) {
Services.prefs.getChildList(branch).forEach(function (name) {
if (Services.prefs.prefIsLocked(name) &&
!PREFS_BLACKLIST.some(function (re) re.test(name)))
prefs[name] = getPref(name);
});
return prefs;
}, {}));
},
graphics: function graphics(done) {
function statusMsgForFeature(feature) {
// We return an array because in the tryNewerDriver case we need to

View File

@ -160,6 +160,10 @@ const SNAPSHOT_SCHEMA = {
required: true,
type: "object",
},
lockedPreferences: {
required: true,
type: "object",
},
graphics: {
required: true,
type: "object",