Bug 1482200 - Remove getBoolPref helper function. r=adw

This commit is contained in:
Diego Pino Garcia 2018-08-23 02:32:00 -04:00
parent 80d0825239
commit 2a06c3fafc

View File

@ -779,18 +779,6 @@ function getLocalizedPref(aPrefName, aDefault) {
return aDefault;
}
/**
* Wrapper for nsIPrefBranch::getBoolPref.
* @param aPrefName
* The name of the pref to get.
* @returns aDefault if the requested pref doesn't exist.
*/
function getBoolPref(aName, aDefault) {
if (Services.prefs.getPrefType(aName) != Ci.nsIPrefBranch.PREF_BOOL)
return aDefault;
return Services.prefs.getBoolPref(aName);
}
/**
* @return a sanitized name to be used as a filename, or a random name
* if a sanitized name cannot be obtained (if aName contains
@ -1415,7 +1403,7 @@ Engine.prototype = {
stringBundle.formatStringFromName("addEngineConfirmation",
[this._name, this._uri.host], 2);
var checkboxMessage = null;
if (!getBoolPref(BROWSER_SEARCH_PREF + "noCurrentEngine", false))
if (!Services.prefs.getBoolPref(BROWSER_SEARCH_PREF + "noCurrentEngine", false))
checkboxMessage = stringBundle.GetStringFromName("addEngineAsCurrentText");
var addButtonLabel =
@ -3542,7 +3530,7 @@ SearchService.prototype = {
// If the user has specified a custom engine order, read the order
// information from the metadata instead of the default prefs.
if (getBoolPref(BROWSER_SEARCH_PREF + "useDBForOrder", false)) {
if (Services.prefs.getBoolPref(BROWSER_SEARCH_PREF + "useDBForOrder", false)) {
LOG("_buildSortedEngineList: using db for order");
// Flag to keep track of whether or not we need to call _saveSortedEngineList.
@ -4468,7 +4456,7 @@ SearchService.prototype = {
notify: function SRCH_SVC_notify(aTimer) {
LOG("_notify: checking for updates");
if (!getBoolPref(BROWSER_SEARCH_PREF + "update", true))
if (!Services.prefs.getBoolPref(BROWSER_SEARCH_PREF + "update", true))
return;
// Our timer has expired, but unfortunately, we can't get any data from it.
@ -4573,7 +4561,7 @@ const SEARCH_UPDATE_LOG_PREFIX = "*** Search update: ";
* logging pref (browser.search.update.log) is set to true.
*/
function ULOG(aText) {
if (getBoolPref(BROWSER_SEARCH_PREF + "update.log", false)) {
if (Services.prefs.getBoolPref(BROWSER_SEARCH_PREF + "update.log", false)) {
dump(SEARCH_UPDATE_LOG_PREFIX + aText + "\n");
Services.console.logStringMessage(aText);
}
@ -4589,7 +4577,8 @@ var engineUpdateService = {
update: function eus_Update(aEngine) {
let engine = aEngine.wrappedJSObject;
ULOG("update called for " + aEngine._name);
if (!getBoolPref(BROWSER_SEARCH_PREF + "update", true) || !engine._hasUpdates)
if (!Services.prefs.getBoolPref(BROWSER_SEARCH_PREF + "update", true) ||
!engine._hasUpdates)
return;
let testEngine = null;