From 27ba2c13dfba0343c5b20aedfefbb96de89c3ff3 Mon Sep 17 00:00:00 2001 From: "Bernardo P. Rittmeyer" Date: Thu, 5 Jun 2014 02:47:00 +1200 Subject: [PATCH] Bug 804430 - Added list of whitelisted locked prefs to about:support. r=Unfocused --- toolkit/content/aboutSupport.js | 11 ++++++++++ toolkit/content/aboutSupport.xhtml | 21 +++++++++++++++++++ .../en-US/chrome/global/aboutSupport.dtd | 4 ++++ toolkit/modules/Troubleshoot.jsm | 21 +++++++++++++++++++ 4 files changed, 57 insertions(+) diff --git a/toolkit/content/aboutSupport.js b/toolkit/content/aboutSupport.js index bd7cb708863..77986e0ce28 100644 --- a/toolkit/content/aboutSupport.js +++ b/toolkit/content/aboutSupport.js @@ -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) { diff --git a/toolkit/content/aboutSupport.xhtml b/toolkit/content/aboutSupport.xhtml index 99350e8925b..753a8283b90 100644 --- a/toolkit/content/aboutSupport.xhtml +++ b/toolkit/content/aboutSupport.xhtml @@ -263,6 +263,27 @@

&aboutSupport.userJSDescription;

+ + +

+ &aboutSupport.lockedKeyPrefsTitle; +

+ + + + + + + + + + +
+ &aboutSupport.lockedPrefsName; + + &aboutSupport.lockedPrefsValue; +
+

&aboutSupport.jsTitle; diff --git a/toolkit/locales/en-US/chrome/global/aboutSupport.dtd b/toolkit/locales/en-US/chrome/global/aboutSupport.dtd index 57d8f40da7d..dae675cef32 100644 --- a/toolkit/locales/en-US/chrome/global/aboutSupport.dtd +++ b/toolkit/locales/en-US/chrome/global/aboutSupport.dtd @@ -71,6 +71,10 @@ variant of aboutSupport.showDir.label. --> user.js file, which includes preferences that were not created by &brandShortName;."> + + + + diff --git a/toolkit/modules/Troubleshoot.jsm b/toolkit/modules/Troubleshoot.jsm index 1d72f5f552d..ce097d8f989 100644 --- a/toolkit/modules/Troubleshoot.jsm +++ b/toolkit/modules/Troubleshoot.jsm @@ -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