summaryrefslogtreecommitdiffstats
path: root/toolkit/mozapps/extensions/internal/AddonRepository.jsm
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/AddonRepository.jsm
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/AddonRepository.jsm')
-rw-r--r--toolkit/mozapps/extensions/internal/AddonRepository.jsm32
1 files changed, 7 insertions, 25 deletions
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) => {