summaryrefslogtreecommitdiffstats
path: root/toolkit/mozapps/extensions/internal
diff options
context:
space:
mode:
authorAscrod <32915892+Ascrod@users.noreply.github.com>2019-04-13 11:22:15 -0400
committerAscrod <32915892+Ascrod@users.noreply.github.com>2019-04-13 11:37:45 -0400
commit8757548a3e5b5cc4d159d61eb4a12c7af1be548e (patch)
tree3ad7d1f2c10d3d4c7a5d3779b2ee55cde34cfce6 /toolkit/mozapps/extensions/internal
parent714e9c9074d9eb2f4063962d07bae6b4f02a1e7a (diff)
downloadUXP-8757548a3e5b5cc4d159d61eb4a12c7af1be548e.tar
UXP-8757548a3e5b5cc4d159d61eb4a12c7af1be548e.tar.gz
UXP-8757548a3e5b5cc4d159d61eb4a12c7af1be548e.tar.lz
UXP-8757548a3e5b5cc4d159d61eb4a12c7af1be548e.tar.xz
UXP-8757548a3e5b5cc4d159d61eb4a12c7af1be548e.zip
Issue #991 Part 8: Toolkit everything else
Diffstat (limited to 'toolkit/mozapps/extensions/internal')
-rw-r--r--toolkit/mozapps/extensions/internal/AddonLogging.jsm7
-rw-r--r--toolkit/mozapps/extensions/internal/AddonRepository.jsm32
-rw-r--r--toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm14
-rw-r--r--toolkit/mozapps/extensions/internal/XPIProviderUtils.js5
4 files changed, 11 insertions, 47 deletions
diff --git a/toolkit/mozapps/extensions/internal/AddonLogging.jsm b/toolkit/mozapps/extensions/internal/AddonLogging.jsm
index f05a6fe6c..ffa92c791 100644
--- a/toolkit/mozapps/extensions/internal/AddonLogging.jsm
+++ b/toolkit/mozapps/extensions/internal/AddonLogging.jsm
@@ -179,12 +179,7 @@ var PrefObserver = {
Services.obs.removeObserver(this, "xpcom-shutdown");
}
else if (aTopic == NS_PREFBRANCH_PREFCHANGE_TOPIC_ID) {
- try {
- gDebugLogEnabled = Services.prefs.getBoolPref(PREF_LOGGING_ENABLED);
- }
- catch (e) {
- gDebugLogEnabled = false;
- }
+ gDebugLogEnabled = Services.prefs.getBoolPref(PREF_LOGGING_ENABLED, false);
}
}
};
diff --git a/toolkit/mozapps/extensions/internal/AddonRepository.jsm b/toolkit/mozapps/extensions/internal/AddonRepository.jsm
index 76a7528c7..9750e9944 100644
--- a/toolkit/mozapps/extensions/internal/AddonRepository.jsm
+++ b/toolkit/mozapps/extensions/internal/AddonRepository.jsm
@@ -486,14 +486,7 @@ this.AddonRepository = {
}
let preference = PREF_GETADDONS_CACHE_ENABLED;
- let enabled = false;
- try {
- enabled = Services.prefs.getBoolPref(preference);
- } catch(e) {
- logger.warn("cacheEnabled: Couldn't get pref: " + preference);
- }
-
- return enabled;
+ return Services.prefs.getBoolPref(preference, false);
},
// A cache of the add-ons stored in the database
@@ -541,11 +534,7 @@ this.AddonRepository = {
metadataAge: function() {
let now = Math.round(Date.now() / 1000);
-
- let lastUpdate = 0;
- try {
- lastUpdate = Services.prefs.getIntPref(PREF_METADATA_LASTUPDATE);
- } catch (e) {}
+ let lastUpdate = Services.prefs.getIntPref(PREF_METADATA_LASTUPDATE, 0);
// Handle clock jumps
if (now < lastUpdate) {
@@ -555,10 +544,8 @@ this.AddonRepository = {
},
isMetadataStale: function AddonRepo_isMetadataStale() {
- let threshold = DEFAULT_METADATA_UPDATETHRESHOLD_SEC;
- try {
- threshold = Services.prefs.getIntPref(PREF_METADATA_UPDATETHRESHOLD_SEC);
- } catch (e) {}
+ let threshold = Services.prefs.getIntPref(PREF_METADATA_UPDATETHRESHOLD_SEC,
+ DEFAULT_METADATA_UPDATETHRESHOLD_SEC);
return (this.metadataAge() > threshold);
},
@@ -1543,10 +1530,8 @@ this.AddonRepository = {
// Create url from preference, returning null if preference does not exist
_formatURLPref: function AddonRepo_formatURLPref(aPreference, aSubstitutions) {
- let url = null;
- try {
- url = Services.prefs.getCharPref(aPreference);
- } catch(e) {
+ let url = Services.prefs.getCharPref(aPreference, "");
+ if (!url) {
logger.warn("_formatURLPref: Couldn't get pref: " + aPreference);
return null;
}
@@ -1639,10 +1624,7 @@ var AddonDatabase = {
// Create a blank addons.json file
this._saveDBToDisk();
- let dbSchema = 0;
- try {
- dbSchema = Services.prefs.getIntPref(PREF_GETADDONS_DB_SCHEMA);
- } catch (e) {}
+ let dbSchema = Services.prefs.getIntPref(PREF_GETADDONS_DB_SCHEMA, 0);
if (dbSchema < DB_MIN_JSON_SCHEMA) {
let results = yield new Promise((resolve, reject) => {
diff --git a/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm b/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm
index c06dca1d5..a475f7f1f 100644
--- a/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm
+++ b/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm
@@ -608,12 +608,7 @@ function UpdateParser(aId, aUpdateKey, aUrl, aObserver) {
this.observer = aObserver;
this.url = aUrl;
- let requireBuiltIn = true;
- try {
- requireBuiltIn = Services.prefs.getBoolPref(PREF_UPDATE_REQUIREBUILTINCERTS);
- }
- catch (e) {
- }
+ let requireBuiltIn = Services.prefs.getBoolPref(PREF_UPDATE_REQUIREBUILTINCERTS, true);
logger.debug("Requesting " + aUrl);
try {
@@ -651,12 +646,7 @@ UpdateParser.prototype = {
this.request = null;
this._doneAt = new Error("place holder");
- let requireBuiltIn = true;
- try {
- requireBuiltIn = Services.prefs.getBoolPref(PREF_UPDATE_REQUIREBUILTINCERTS);
- }
- catch (e) {
- }
+ let requireBuiltIn = Services.prefs.getBoolPref(PREF_UPDATE_REQUIREBUILTINCERTS, true);
try {
CertUtils.checkCert(request.channel, !requireBuiltIn);
diff --git a/toolkit/mozapps/extensions/internal/XPIProviderUtils.js b/toolkit/mozapps/extensions/internal/XPIProviderUtils.js
index f2420bd1a..69d774e4a 100644
--- a/toolkit/mozapps/extensions/internal/XPIProviderUtils.js
+++ b/toolkit/mozapps/extensions/internal/XPIProviderUtils.js
@@ -1410,10 +1410,7 @@ this.XPIDatabase = {
// when a lightweight theme is applied for example)
text += "\r\n[ThemeDirs]\r\n";
- let dssEnabled = false;
- try {
- dssEnabled = Services.prefs.getBoolPref(PREF_EM_DSS_ENABLED);
- } catch (e) {}
+ let dssEnabled = Services.prefs.getBoolPref(PREF_EM_DSS_ENABLED, false);
let themes = [];
if (dssEnabled) {