Bug 524270 - Make the second getChildList parameter optional. r=bsmedberg

This commit is contained in:
Dão Gottwald 2009-10-26 21:02:06 +01:00
parent 9ec5916293
commit b6e71f34a2
12 changed files with 20 additions and 25 deletions

View File

@ -265,7 +265,7 @@ function getModifiedPrefs() {
function getWhitelistedPrefNames() { function getWhitelistedPrefNames() {
let results = []; let results = [];
PREFS_WHITELIST.forEach(function (prefStem) { PREFS_WHITELIST.forEach(function (prefStem) {
let prefNames = gPrefService.getChildList(prefStem, {}); let prefNames = gPrefService.getChildList(prefStem);
results = results.concat(prefNames); results = results.concat(prefNames);
}); });
return results; return results;

View File

@ -1540,8 +1540,7 @@ function initializeSanitizer()
*/ */
if (!gPrefService.getBoolPref("privacy.sanitize.migrateFx3Prefs")) { if (!gPrefService.getBoolPref("privacy.sanitize.migrateFx3Prefs")) {
let itemBranch = gPrefService.getBranch("privacy.item."); let itemBranch = gPrefService.getBranch("privacy.item.");
let itemCount = { value: 0 }; let itemArray = itemBranch.getChildList("");
let itemArray = itemBranch.getChildList("", itemCount);
// See if any privacy.item prefs are set // See if any privacy.item prefs are set
let doMigrate = itemArray.some(function (name) itemBranch.prefHasUserValue(name)); let doMigrate = itemArray.some(function (name) itemBranch.prefHasUserValue(name));

View File

@ -806,7 +806,7 @@ WebContentConverterRegistrar.prototype = {
* branch and stop cycling once that's true. This doesn't fix the case * branch and stop cycling once that's true. This doesn't fix the case
* where a user manually removes a reader, but that's not supported yet! * where a user manually removes a reader, but that's not supported yet!
*/ */
var vals = branch.getChildList("", {}); var vals = branch.getChildList("");
if (vals.length == 0) if (vals.length == 0)
return; return;
@ -832,7 +832,7 @@ WebContentConverterRegistrar.prototype = {
getService(Ci.nsIPrefService); getService(Ci.nsIPrefService);
var kids = ps.getBranch(PREF_CONTENTHANDLERS_BRANCH) var kids = ps.getBranch(PREF_CONTENTHANDLERS_BRANCH)
.getChildList("", {}); .getChildList("");
// first get the numbers of the providers by getting all ###.uri prefs // first get the numbers of the providers by getting all ###.uri prefs
var nums = []; var nums = [];
@ -857,7 +857,7 @@ WebContentConverterRegistrar.prototype = {
// so that getWebContentHandlerByURI can return successfully. // so that getWebContentHandlerByURI can return successfully.
try { try {
var autoBranch = ps.getBranch(PREF_CONTENTHANDLERS_AUTO); var autoBranch = ps.getBranch(PREF_CONTENTHANDLERS_AUTO);
var childPrefs = autoBranch.getChildList("", { }); var childPrefs = autoBranch.getChildList("");
for (var i = 0; i < childPrefs.length; ++i) { for (var i = 0; i < childPrefs.length; ++i) {
var type = childPrefs[i]; var type = childPrefs[i];
var uri = autoBranch.getCharPref(type); var uri = autoBranch.getCharPref(type);

View File

@ -269,8 +269,7 @@ RTestIndexList.prototype = {
load : function() load : function()
{ {
var count = {value:null}; var prefList = this.mPrefBranch.getChildList("");
var prefList = this.mPrefBranch.getChildList("", count);
var i = 0; var i = 0;
for (var pref in prefList) { for (var pref in prefList) {

View File

@ -329,7 +329,8 @@ interface nsIPrefBranch : nsISupports
* @return NS_OK The preference list was successfully retrieved. * @return NS_OK The preference list was successfully retrieved.
* @return Other The preference(s) do not exist or an error occurred. * @return Other The preference(s) do not exist or an error occurred.
*/ */
void getChildList(in string aStartingAt, out unsigned long aCount, void getChildList(in string aStartingAt,
[optional] out unsigned long aCount,
[array, size_is(aCount), retval] out string aChildArray); [array, size_is(aCount), retval] out string aChildArray);
/** /**

View File

@ -211,7 +211,7 @@ PreferenceBranch.prototype = {
// modified: true, false (prefHasUserValue) // modified: true, false (prefHasUserValue)
find : function prefs_find(aOptions) { find : function prefs_find(aOptions) {
var retVal = []; var retVal = [];
var items = this._prefs.getChildList("", []); var items = this._prefs.getChildList("");
for (var i = 0; i < items.length; i++) { for (var i = 0; i < items.length; i++) {
retVal.push(new Preference(items[i], this)); retVal.push(new Preference(items[i], this));

View File

@ -2975,7 +2975,7 @@ SearchService.prototype = {
try { try {
var extras = var extras =
gPrefSvc.getChildList(BROWSER_SEARCH_PREF + "order.extra.", { }); gPrefSvc.getChildList(BROWSER_SEARCH_PREF + "order.extra.");
for each (prefName in extras) { for each (prefName in extras) {
engineName = gPrefSvc.getCharPref(prefName); engineName = gPrefSvc.getCharPref(prefName);
@ -3173,8 +3173,7 @@ SearchService.prototype = {
// First, look at the "browser.search.order.extra" branch. // First, look at the "browser.search.order.extra" branch.
try { try {
var extras = gPrefSvc.getChildList(BROWSER_SEARCH_PREF + "order.extra.", var extras = gPrefSvc.getChildList(BROWSER_SEARCH_PREF + "order.extra.");
{});
for each (var prefName in extras) { for each (var prefName in extras) {
engineName = gPrefSvc.getCharPref(prefName); engineName = gPrefSvc.getCharPref(prefName);

View File

@ -334,17 +334,14 @@ function onConfigLoad()
// Unhide the warning message // Unhide the warning message
function ShowPrefs() function ShowPrefs()
{ {
var prefCount = { value: 0 }; var prefArray = gPrefBranch.getChildList("");
var prefArray = gPrefBranch.getChildList("", prefCount);
for (var i = 0; i < prefCount.value; ++i) prefArray.forEach(function (prefName) {
{
var prefName = prefArray[i];
if (/^capability\./.test(prefName)) // avoid displaying "private" preferences if (/^capability\./.test(prefName)) // avoid displaying "private" preferences
continue; return;
fetchPref(prefName, gPrefArray.length); fetchPref(prefName, gPrefArray.length);
} });
var descending = document.getElementsByAttribute("sortDirection", "descending"); var descending = document.getElementsByAttribute("sortDirection", "descending");
if (descending.item(0)) { if (descending.item(0)) {

View File

@ -208,7 +208,7 @@ function getUpdateChannel() {
} }
try { try {
var partners = gPref.getChildList(PREF_PARTNER_BRANCH, { }); var partners = gPref.getChildList(PREF_PARTNER_BRANCH);
if (partners.length) { if (partners.length) {
channel += "-cck"; channel += "-cck";
partners.sort(); partners.sort();

View File

@ -348,7 +348,7 @@ var gUpdates = {
var ps = CoC["@mozilla.org/preferences-service;1"]. var ps = CoC["@mozilla.org/preferences-service;1"].
getService(CoI.nsIPrefService); getService(CoI.nsIPrefService);
var logBranch = ps.getBranch(PREF_APP_UPDATE_LOG_BRANCH); var logBranch = ps.getBranch(PREF_APP_UPDATE_LOG_BRANCH);
var modules = logBranch.getChildList("", { value: 0 }); var modules = logBranch.getChildList("");
for (var i = 0; i < modules.length; ++i) { for (var i = 0; i < modules.length; ++i) {
if (logBranch.prefHasUserValue(modules[i])) if (logBranch.prefHasUserValue(modules[i]))

View File

@ -153,7 +153,7 @@ XPCOMUtils.defineLazyGetter(this, "gLogEnabled", function() {
let ps = Cc["@mozilla.org/preferences-service;1"]. let ps = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefService); getService(Ci.nsIPrefService);
let logBranch = ps.getBranch(PREF_APP_UPDATE_LOG_BRANCH); let logBranch = ps.getBranch(PREF_APP_UPDATE_LOG_BRANCH);
let modules = logBranch.getChildList("", { value: 0 }); let modules = logBranch.getChildList("");
for (let i = 0; i < modules.length; ++i) { for (let i = 0; i < modules.length; ++i) {
if (logBranch.prefHasUserValue(modules[i])) if (logBranch.prefHasUserValue(modules[i]))
logEnabled[modules[i]] = logBranch.getBoolPref(modules[i]); logEnabled[modules[i]] = logBranch.getBoolPref(modules[i]);
@ -506,7 +506,7 @@ function getUpdateChannel() {
} }
try { try {
var partners = gPref.getChildList(PREF_PARTNER_BRANCH, { }); var partners = gPref.getChildList(PREF_PARTNER_BRANCH);
if (partners.length) { if (partners.length) {
channel += "-cck"; channel += "-cck";
partners.sort(); partners.sort();

View File

@ -235,7 +235,7 @@ HandlerService.prototype = {
getService(Ci.nsIPrefService); getService(Ci.nsIPrefService);
let schemesPrefBranch = prefSvc.getBranch("gecko.handlerService.schemes."); let schemesPrefBranch = prefSvc.getBranch("gecko.handlerService.schemes.");
let schemePrefList = schemesPrefBranch.getChildList("", {}); let schemePrefList = schemesPrefBranch.getChildList("");
var schemes = {}; var schemes = {};