diff options
author | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-03-25 17:47:59 +0100 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-03-25 17:47:59 +0100 |
commit | 917a2c450f08ab4c934c9938319f10a1114272b4 (patch) | |
tree | 79394bdbef8c5bc90734918a9f862efaf6ec2e1a /toolkit/components/search/current/nsSearchService.js | |
parent | eb77e289bbe056b58051db0fa868e95da803aa0a (diff) | |
parent | a1ad1d835b66e9300cc011244a23aea5d660baf1 (diff) | |
download | UXP-917a2c450f08ab4c934c9938319f10a1114272b4.tar UXP-917a2c450f08ab4c934c9938319f10a1114272b4.tar.gz UXP-917a2c450f08ab4c934c9938319f10a1114272b4.tar.lz UXP-917a2c450f08ab4c934c9938319f10a1114272b4.tar.xz UXP-917a2c450f08ab4c934c9938319f10a1114272b4.zip |
Merge branch 'master' of https://github.com/MoonchildProductions/UXP
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; |