summaryrefslogtreecommitdiffstats
path: root/toolkit/components/blocklist/nsBlocklistService.js
diff options
context:
space:
mode:
authorAscrod <32915892+Ascrod@users.noreply.github.com>2019-03-24 20:22:03 -0400
committerAscrod <32915892+Ascrod@users.noreply.github.com>2019-03-24 20:22:03 -0400
commitc9d2e9bcfb77657b3be7d368e57f43747c23ddc4 (patch)
tree0956b0a08cd9b742821205535942913835ec97bc /toolkit/components/blocklist/nsBlocklistService.js
parentcac3f9678de46298a93537e8913912bba28d89f7 (diff)
downloadUXP-c9d2e9bcfb77657b3be7d368e57f43747c23ddc4.tar
UXP-c9d2e9bcfb77657b3be7d368e57f43747c23ddc4.tar.gz
UXP-c9d2e9bcfb77657b3be7d368e57f43747c23ddc4.tar.lz
UXP-c9d2e9bcfb77657b3be7d368e57f43747c23ddc4.tar.xz
UXP-c9d2e9bcfb77657b3be7d368e57f43747c23ddc4.zip
Remove obsolete getPref helpers.
Diffstat (limited to 'toolkit/components/blocklist/nsBlocklistService.js')
-rw-r--r--toolkit/components/blocklist/nsBlocklistService.js43
1 files changed, 11 insertions, 32 deletions
diff --git a/toolkit/components/blocklist/nsBlocklistService.js b/toolkit/components/blocklist/nsBlocklistService.js
index 1cd2ed806..49033fc8f 100644
--- a/toolkit/components/blocklist/nsBlocklistService.js
+++ b/toolkit/components/blocklist/nsBlocklistService.js
@@ -169,27 +169,6 @@ function LOG(string) {
}
/**
- * Gets a preference value, handling the case where there is no default.
- * @param func
- * The name of the preference function to call, on nsIPrefBranch
- * @param preference
- * The name of the preference
- * @param defaultValue
- * The default value to return in the event the preference has
- * no setting
- * @returns The value of the preference, or undefined if there was no
- * user or default value.
- */
-function getPref(func, preference, defaultValue) {
- try {
- return gPref[func](preference);
- }
- catch (e) {
- }
- return defaultValue;
-}
-
-/**
* Constructs a URI to a spec.
* @param spec
* The spec to construct a URI to
@@ -297,9 +276,9 @@ function parseRegExp(aStr) {
function Blocklist() {
Services.obs.addObserver(this, "xpcom-shutdown", false);
Services.obs.addObserver(this, "sessionstore-windows-restored", false);
- gLoggingEnabled = getPref("getBoolPref", PREF_EM_LOGGING_ENABLED, false);
- gBlocklistEnabled = getPref("getBoolPref", PREF_BLOCKLIST_ENABLED, true);
- gBlocklistLevel = Math.min(getPref("getIntPref", PREF_BLOCKLIST_LEVEL, DEFAULT_LEVEL),
+ gLoggingEnabled = Services.prefs.getBoolPref(PREF_EM_LOGGING_ENABLED, false);
+ gBlocklistEnabled = Services.prefs.getBoolPref(PREF_BLOCKLIST_ENABLED, true);
+ gBlocklistLevel = Math.min(Services.prefs.getIntPref(PREF_BLOCKLIST_LEVEL, DEFAULT_LEVEL),
MAX_BLOCK_LEVEL);
gPref.addObserver("extensions.blocklist.", this, false);
gPref.addObserver(PREF_EM_LOGGING_ENABLED, this, false);
@@ -345,15 +324,15 @@ Blocklist.prototype = {
case "nsPref:changed":
switch (aData) {
case PREF_EM_LOGGING_ENABLED:
- gLoggingEnabled = getPref("getBoolPref", PREF_EM_LOGGING_ENABLED, false);
+ gLoggingEnabled = Services.prefs.getBoolPref(PREF_EM_LOGGING_ENABLED, false);
break;
case PREF_BLOCKLIST_ENABLED:
- gBlocklistEnabled = getPref("getBoolPref", PREF_BLOCKLIST_ENABLED, true);
+ gBlocklistEnabled = Services.prefs.getBoolPref(PREF_BLOCKLIST_ENABLED, true);
this._loadBlocklist();
this._blocklistUpdated(null, null);
break;
case PREF_BLOCKLIST_LEVEL:
- gBlocklistLevel = Math.min(getPref("getIntPref", PREF_BLOCKLIST_LEVEL, DEFAULT_LEVEL),
+ gBlocklistLevel = Math.min(Services.prefs.getIntPref(PREF_BLOCKLIST_LEVEL, DEFAULT_LEVEL),
MAX_BLOCK_LEVEL);
this._blocklistUpdated(null, null);
break;
@@ -525,8 +504,8 @@ Blocklist.prototype = {
return;
}
- var pingCountVersion = getPref("getIntPref", PREF_BLOCKLIST_PINGCOUNTVERSION, 0);
- var pingCountTotal = getPref("getIntPref", PREF_BLOCKLIST_PINGCOUNTTOTAL, 1);
+ var pingCountVersion = Services.prefs.getIntPref(PREF_BLOCKLIST_PINGCOUNTVERSION, 0);
+ var pingCountTotal = Services.prefs.getIntPref(PREF_BLOCKLIST_PINGCOUNTTOTAL, 1);
var daysSinceLastPing = 0;
if (pingCountVersion == 0) {
daysSinceLastPing = "new";
@@ -535,7 +514,7 @@ Blocklist.prototype = {
// Seconds in one day is used because nsIUpdateTimerManager stores the
// last update time in seconds.
let secondsInDay = 60 * 60 * 24;
- let lastUpdateTime = getPref("getIntPref", PREF_BLOCKLIST_LASTUPDATETIME, 0);
+ let lastUpdateTime = Services.prefs.getIntPref(PREF_BLOCKLIST_LASTUPDATETIME, 0);
if (lastUpdateTime == 0) {
daysSinceLastPing = "invalid";
}
@@ -894,7 +873,7 @@ Blocklist.prototype = {
return;
}
- var populateCertBlocklist = getPref("getBoolPref", PREF_ONECRL_VIA_AMO, true);
+ var populateCertBlocklist = Services.prefs.getBoolPref(PREF_ONECRL_VIA_AMO, true);
var childNodes = doc.documentElement.childNodes;
for (let element of childNodes) {
@@ -1466,7 +1445,7 @@ Blocklist.prototype = {
Services.obs.addObserver(applyBlocklistChanges, "addon-blocklist-closed", false);
- if (getPref("getBoolPref", PREF_BLOCKLIST_SUPPRESSUI, false)) {
+ if (Services.prefs.getBoolPref(PREF_BLOCKLIST_SUPPRESSUI, false)) {
applyBlocklistChanges();
return;
}