From 6a530b2454c791805e442eaf25279c44825e5f41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A3o=20Gottwald?= Date: Mon, 26 Oct 2009 21:02:06 +0100 Subject: [PATCH] Bug 524270 - Make the second getChildList parameter optional. r=bsmedberg --- browser/base/content/aboutSupport.xhtml | 2 +- browser/base/content/browser.js | 3 +-- browser/components/feeds/src/WebContentConverter.js | 6 +++--- extensions/layout-debug/ui/content/layoutdebug.js | 3 +-- modules/libpref/public/nsIPrefBranch.idl | 3 ++- toolkit/components/exthelper/extApplication.js | 2 +- toolkit/components/search/nsSearchService.js | 5 ++--- toolkit/components/viewconfig/content/config.js | 11 ++++------- toolkit/mozapps/extensions/src/nsBlocklistService.js | 2 +- toolkit/mozapps/update/content/updates.js | 2 +- toolkit/mozapps/update/src/nsUpdateService.js.in | 4 ++-- uriloader/exthandler/nsHandlerService.js | 2 +- 12 files changed, 20 insertions(+), 25 deletions(-) diff --git a/browser/base/content/aboutSupport.xhtml b/browser/base/content/aboutSupport.xhtml index 5a4a3d7a4df..5f0a9c21910 100644 --- a/browser/base/content/aboutSupport.xhtml +++ b/browser/base/content/aboutSupport.xhtml @@ -265,7 +265,7 @@ function getModifiedPrefs() { function getWhitelistedPrefNames() { let results = []; PREFS_WHITELIST.forEach(function (prefStem) { - let prefNames = gPrefService.getChildList(prefStem, {}); + let prefNames = gPrefService.getChildList(prefStem); results = results.concat(prefNames); }); return results; diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index 32656c7bc36..ee9bf1df08d 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -1540,8 +1540,7 @@ function initializeSanitizer() */ if (!gPrefService.getBoolPref("privacy.sanitize.migrateFx3Prefs")) { let itemBranch = gPrefService.getBranch("privacy.item."); - let itemCount = { value: 0 }; - let itemArray = itemBranch.getChildList("", itemCount); + let itemArray = itemBranch.getChildList(""); // See if any privacy.item prefs are set let doMigrate = itemArray.some(function (name) itemBranch.prefHasUserValue(name)); diff --git a/browser/components/feeds/src/WebContentConverter.js b/browser/components/feeds/src/WebContentConverter.js index f8e0ebdc095..4dd4e2eb666 100644 --- a/browser/components/feeds/src/WebContentConverter.js +++ b/browser/components/feeds/src/WebContentConverter.js @@ -806,7 +806,7 @@ WebContentConverterRegistrar.prototype = { * 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! */ - var vals = branch.getChildList("", {}); + var vals = branch.getChildList(""); if (vals.length == 0) return; @@ -832,7 +832,7 @@ WebContentConverterRegistrar.prototype = { getService(Ci.nsIPrefService); var kids = ps.getBranch(PREF_CONTENTHANDLERS_BRANCH) - .getChildList("", {}); + .getChildList(""); // first get the numbers of the providers by getting all ###.uri prefs var nums = []; @@ -857,7 +857,7 @@ WebContentConverterRegistrar.prototype = { // so that getWebContentHandlerByURI can return successfully. try { var autoBranch = ps.getBranch(PREF_CONTENTHANDLERS_AUTO); - var childPrefs = autoBranch.getChildList("", { }); + var childPrefs = autoBranch.getChildList(""); for (var i = 0; i < childPrefs.length; ++i) { var type = childPrefs[i]; var uri = autoBranch.getCharPref(type); diff --git a/extensions/layout-debug/ui/content/layoutdebug.js b/extensions/layout-debug/ui/content/layoutdebug.js index 5c5eeac02b5..0965a9e18ca 100644 --- a/extensions/layout-debug/ui/content/layoutdebug.js +++ b/extensions/layout-debug/ui/content/layoutdebug.js @@ -269,8 +269,7 @@ RTestIndexList.prototype = { load : function() { - var count = {value:null}; - var prefList = this.mPrefBranch.getChildList("", count); + var prefList = this.mPrefBranch.getChildList(""); var i = 0; for (var pref in prefList) { diff --git a/modules/libpref/public/nsIPrefBranch.idl b/modules/libpref/public/nsIPrefBranch.idl index 6e45421b3a2..6edb50cbbdb 100644 --- a/modules/libpref/public/nsIPrefBranch.idl +++ b/modules/libpref/public/nsIPrefBranch.idl @@ -329,7 +329,8 @@ interface nsIPrefBranch : nsISupports * @return NS_OK The preference list was successfully retrieved. * @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); /** diff --git a/toolkit/components/exthelper/extApplication.js b/toolkit/components/exthelper/extApplication.js index 5df8d4e76cf..9ef6f650012 100644 --- a/toolkit/components/exthelper/extApplication.js +++ b/toolkit/components/exthelper/extApplication.js @@ -211,7 +211,7 @@ PreferenceBranch.prototype = { // modified: true, false (prefHasUserValue) find : function prefs_find(aOptions) { var retVal = []; - var items = this._prefs.getChildList("", []); + var items = this._prefs.getChildList(""); for (var i = 0; i < items.length; i++) { retVal.push(new Preference(items[i], this)); diff --git a/toolkit/components/search/nsSearchService.js b/toolkit/components/search/nsSearchService.js index db0763d677b..e1c545d0222 100644 --- a/toolkit/components/search/nsSearchService.js +++ b/toolkit/components/search/nsSearchService.js @@ -2975,7 +2975,7 @@ SearchService.prototype = { try { var extras = - gPrefSvc.getChildList(BROWSER_SEARCH_PREF + "order.extra.", { }); + gPrefSvc.getChildList(BROWSER_SEARCH_PREF + "order.extra."); for each (prefName in extras) { engineName = gPrefSvc.getCharPref(prefName); @@ -3173,8 +3173,7 @@ SearchService.prototype = { // First, look at the "browser.search.order.extra" branch. 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) { engineName = gPrefSvc.getCharPref(prefName); diff --git a/toolkit/components/viewconfig/content/config.js b/toolkit/components/viewconfig/content/config.js index 605bbc88fd1..1af51eaf2c7 100644 --- a/toolkit/components/viewconfig/content/config.js +++ b/toolkit/components/viewconfig/content/config.js @@ -334,17 +334,14 @@ function onConfigLoad() // Unhide the warning message function ShowPrefs() { - var prefCount = { value: 0 }; - var prefArray = gPrefBranch.getChildList("", prefCount); + var prefArray = gPrefBranch.getChildList(""); - for (var i = 0; i < prefCount.value; ++i) - { - var prefName = prefArray[i]; + prefArray.forEach(function (prefName) { if (/^capability\./.test(prefName)) // avoid displaying "private" preferences - continue; + return; fetchPref(prefName, gPrefArray.length); - } + }); var descending = document.getElementsByAttribute("sortDirection", "descending"); if (descending.item(0)) { diff --git a/toolkit/mozapps/extensions/src/nsBlocklistService.js b/toolkit/mozapps/extensions/src/nsBlocklistService.js index 792849e4604..90f9464d309 100644 --- a/toolkit/mozapps/extensions/src/nsBlocklistService.js +++ b/toolkit/mozapps/extensions/src/nsBlocklistService.js @@ -208,7 +208,7 @@ function getUpdateChannel() { } try { - var partners = gPref.getChildList(PREF_PARTNER_BRANCH, { }); + var partners = gPref.getChildList(PREF_PARTNER_BRANCH); if (partners.length) { channel += "-cck"; partners.sort(); diff --git a/toolkit/mozapps/update/content/updates.js b/toolkit/mozapps/update/content/updates.js index d00e43a2f77..34ff84ab353 100644 --- a/toolkit/mozapps/update/content/updates.js +++ b/toolkit/mozapps/update/content/updates.js @@ -348,7 +348,7 @@ var gUpdates = { var ps = CoC["@mozilla.org/preferences-service;1"]. getService(CoI.nsIPrefService); 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) { if (logBranch.prefHasUserValue(modules[i])) diff --git a/toolkit/mozapps/update/src/nsUpdateService.js.in b/toolkit/mozapps/update/src/nsUpdateService.js.in index 57f02e9fbed..13efbaf7ffb 100644 --- a/toolkit/mozapps/update/src/nsUpdateService.js.in +++ b/toolkit/mozapps/update/src/nsUpdateService.js.in @@ -153,7 +153,7 @@ XPCOMUtils.defineLazyGetter(this, "gLogEnabled", function() { let ps = Cc["@mozilla.org/preferences-service;1"]. getService(Ci.nsIPrefService); 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) { if (logBranch.prefHasUserValue(modules[i])) logEnabled[modules[i]] = logBranch.getBoolPref(modules[i]); @@ -506,7 +506,7 @@ function getUpdateChannel() { } try { - var partners = gPref.getChildList(PREF_PARTNER_BRANCH, { }); + var partners = gPref.getChildList(PREF_PARTNER_BRANCH); if (partners.length) { channel += "-cck"; partners.sort(); diff --git a/uriloader/exthandler/nsHandlerService.js b/uriloader/exthandler/nsHandlerService.js index e5c21f04b76..0208dd170b8 100644 --- a/uriloader/exthandler/nsHandlerService.js +++ b/uriloader/exthandler/nsHandlerService.js @@ -235,7 +235,7 @@ HandlerService.prototype = { getService(Ci.nsIPrefService); let schemesPrefBranch = prefSvc.getBranch("gecko.handlerService.schemes."); - let schemePrefList = schemesPrefBranch.getChildList("", {}); + let schemePrefList = schemesPrefBranch.getChildList(""); var schemes = {};