diff options
author | Moonchild <mcwerewolf@wolfbeast.com> | 2019-03-25 09:33:03 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-25 09:33:03 +0100 |
commit | a1ad1d835b66e9300cc011244a23aea5d660baf1 (patch) | |
tree | 0956b0a08cd9b742821205535942913835ec97bc /toolkit/components/search/current/nsSearchService.js | |
parent | 834ea744c2bf56d951c0134f6043f692b28c36ef (diff) | |
parent | c9d2e9bcfb77657b3be7d368e57f43747c23ddc4 (diff) | |
download | UXP-a1ad1d835b66e9300cc011244a23aea5d660baf1.tar UXP-a1ad1d835b66e9300cc011244a23aea5d660baf1.tar.gz UXP-a1ad1d835b66e9300cc011244a23aea5d660baf1.tar.lz UXP-a1ad1d835b66e9300cc011244a23aea5d660baf1.tar.xz UXP-a1ad1d835b66e9300cc011244a23aea5d660baf1.zip |
Merge pull request #1023 from Ascrod/default-pref
Remove obsolete getPref helpers.
Diffstat (limited to 'toolkit/components/search/current/nsSearchService.js')
-rw-r--r-- | toolkit/components/search/current/nsSearchService.js | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/toolkit/components/search/current/nsSearchService.js b/toolkit/components/search/current/nsSearchService.js index 6e8f6da43..2a8601078 100644 --- a/toolkit/components/search/current/nsSearchService.js +++ b/toolkit/components/search/current/nsSearchService.js @@ -234,7 +234,7 @@ var LOG = function() {}; if (AppConstants.DEBUG) { LOG = function (aText) { - if (getBoolPref(BROWSER_SEARCH_PREF + "log", false)) { + if (Services.prefs.getBoolPref(BROWSER_SEARCH_PREF + "log", false)) { DO_LOG(aText); } }; @@ -908,18 +908,6 @@ function getLocalizedPref(aPrefName, 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 * no valid characters). @@ -1534,7 +1522,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 = @@ -2658,7 +2646,7 @@ function checkForSyncCompletion(aPromise) { // nsIBrowserSearchService function SearchService() { // Replace empty LOG function with the useful one if the log pref is set. - if (getBoolPref(BROWSER_SEARCH_PREF + "log", false)) + if (Services.prefs.getBoolPref(BROWSER_SEARCH_PREF + "log", false)) LOG = DO_LOG; this._initObservers = Promise.defer(); @@ -3770,7 +3758,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. @@ -4624,7 +4612,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. @@ -4735,7 +4723,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); } @@ -4751,7 +4739,7 @@ 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; |