summaryrefslogtreecommitdiffstats
path: root/toolkit
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
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')
-rw-r--r--toolkit/content/widgets/browser.xml23
-rw-r--r--toolkit/content/widgets/preferences.xml8
-rw-r--r--toolkit/content/widgets/scrollbox.xml27
-rw-r--r--toolkit/modules/NewTabUtils.jsm20
-rw-r--r--toolkit/modules/PermissionsUtils.jsm5
-rw-r--r--toolkit/modules/UpdateUtils.jsm18
-rw-r--r--toolkit/modules/secondscreen/SimpleServiceDiscovery.jsm5
-rw-r--r--toolkit/mozapps/downloads/nsHelperAppDlg.js5
-rw-r--r--toolkit/mozapps/extensions/AddonManager.jsm79
-rw-r--r--toolkit/mozapps/extensions/DeferredSave.jsm7
-rw-r--r--toolkit/mozapps/extensions/GMPUtils.jsm8
-rw-r--r--toolkit/mozapps/extensions/LightweightThemeManager.jsm15
-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
16 files changed, 62 insertions, 216 deletions
diff --git a/toolkit/content/widgets/browser.xml b/toolkit/content/widgets/browser.xml
index 9c72e86d8..11ed998cc 100644
--- a/toolkit/content/widgets/browser.xml
+++ b/toolkit/content/widgets/browser.xml
@@ -19,14 +19,7 @@
if (this.getAttribute("autoscroll") == "false")
return false;
- var enabled = true;
- try {
- enabled = this.mPrefs.getBoolPref("general.autoScroll");
- }
- catch (ex) {
- }
-
- return enabled;
+ return this.mPrefs.getBoolPref("general.autoScroll", true);
]]>
</getter>
</property>
@@ -1427,18 +1420,8 @@
return;
// Toggle browse with caret mode
- var browseWithCaretOn = false;
- var warn = true;
-
- try {
- warn = this.mPrefs.getBoolPref(kPrefWarnOnEnable);
- } catch (ex) {
- }
-
- try {
- browseWithCaretOn = this.mPrefs.getBoolPref(kPrefCaretBrowsingOn);
- } catch (ex) {
- }
+ var browseWithCaretOn = this.mPrefs.getBoolPref(kPrefCaretBrowsingOn, false);
+ var warn = this.mPrefs.getBoolPref(kPrefWarnOnEnable, true);
if (warn && !browseWithCaretOn) {
var checkValue = {value:false};
var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
diff --git a/toolkit/content/widgets/preferences.xml b/toolkit/content/widgets/preferences.xml
index 9fb2ac7ea..11de03246 100644
--- a/toolkit/content/widgets/preferences.xml
+++ b/toolkit/content/widgets/preferences.xml
@@ -893,12 +893,8 @@
<![CDATA[
var psvc = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
- var animate = /Mac/.test(navigator.platform);
- try {
- animate = psvc.getBoolPref("browser.preferences.animateFadeIn");
- }
- catch (e) { }
- return animate;
+ return psvc.getBoolPref("browser.preferences.animateFadeIn",
+ /Mac/.test(navigator.platform));
]]>
</getter>
</property>
diff --git a/toolkit/content/widgets/scrollbox.xml b/toolkit/content/widgets/scrollbox.xml
index ff57a5911..219b7cb5e 100644
--- a/toolkit/content/widgets/scrollbox.xml
+++ b/toolkit/content/widgets/scrollbox.xml
@@ -80,13 +80,8 @@
<property name="scrollIncrement" readonly="true">
<getter><![CDATA[
if (this._scrollIncrement === null) {
- try {
- this._scrollIncrement = this._prefBranch
- .getIntPref("toolkit.scrollbox.scrollIncrement");
- }
- catch (ex) {
- this._scrollIncrement = 20;
- }
+ this._scrollIncrement = this._prefBranch
+ .getIntPref("toolkit.scrollbox.scrollIncrement", 20);
}
return this._scrollIncrement;
]]></getter>
@@ -99,13 +94,8 @@
if (this.hasAttribute("smoothscroll")) {
this._smoothScroll = (this.getAttribute("smoothscroll") == "true");
} else {
- try {
- this._smoothScroll = this._prefBranch
- .getBoolPref("toolkit.scrollbox.smoothScroll");
- }
- catch (ex) {
- this._smoothScroll = true;
- }
+ this._smoothScroll = this._prefBranch
+ .getBoolPref("toolkit.scrollbox.smoothScroll", true);
}
}
return this._smoothScroll;
@@ -737,12 +727,9 @@
</content>
<implementation implements="nsITimerCallback, nsIDOMEventListener">
<constructor><![CDATA[
- try {
- this._scrollDelay = this._prefBranch
- .getIntPref("toolkit.scrollbox.clickToScroll.scrollDelay");
- }
- catch (ex) {
- }
+ this._scrollDelay = this._prefBranch
+ .getIntPref("toolkit.scrollbox.clickToScroll.scrollDelay",
+ this._scrollDelay);
]]></constructor>
<destructor><![CDATA[
diff --git a/toolkit/modules/NewTabUtils.jsm b/toolkit/modules/NewTabUtils.jsm
index 548d87dda..35e38156f 100644
--- a/toolkit/modules/NewTabUtils.jsm
+++ b/toolkit/modules/NewTabUtils.jsm
@@ -119,18 +119,14 @@ LinksStorage.prototype = {
get _storedVersion() {
if (this.__storedVersion === undefined) {
- try {
- this.__storedVersion =
- Services.prefs.getIntPref("browser.newtabpage.storageVersion");
- } catch (ex) {
- // The storage version is unknown, so either:
- // - it's a new profile
- // - it's a profile where versioning information got lost
- // In this case we still run through all of the valid migrations,
- // starting from 1, as if it was a downgrade. As previously stated the
- // migrations should already support running on an updated store.
- this.__storedVersion = 1;
- }
+ // The storage version is unknown, so either:
+ // - it's a new profile
+ // - it's a profile where versioning information got lost
+ // In this case we still run through all of the valid migrations,
+ // starting from 1, as if it was a downgrade. As previously stated the
+ // migrations should already support running on an updated store.
+ this.__storedVersion =
+ Services.prefs.getIntPref("browser.newtabpage.storageVersion", 1);
}
return this.__storedVersion;
},
diff --git a/toolkit/modules/PermissionsUtils.jsm b/toolkit/modules/PermissionsUtils.jsm
index dfed76f0c..4bf43a3ec 100644
--- a/toolkit/modules/PermissionsUtils.jsm
+++ b/toolkit/modules/PermissionsUtils.jsm
@@ -16,10 +16,7 @@ function importPrefBranch(aPrefBranch, aPermission, aAction) {
let list = Services.prefs.getChildList(aPrefBranch, {});
for (let pref of list) {
- let origins = "";
- try {
- origins = Services.prefs.getCharPref(pref);
- } catch (e) {}
+ let origins = Services.prefs.getCharPref(pref, "");
if (!origins)
continue;
diff --git a/toolkit/modules/UpdateUtils.jsm b/toolkit/modules/UpdateUtils.jsm
index e92b1b797..fed7c7637 100644
--- a/toolkit/modules/UpdateUtils.jsm
+++ b/toolkit/modules/UpdateUtils.jsm
@@ -31,13 +31,9 @@ this.UpdateUtils = {
* Whether or not to include the partner bits. Default: true.
*/
getUpdateChannel(aIncludePartners = true) {
- let channel = AppConstants.MOZ_UPDATE_CHANNEL;
+ let channel = defaults.getCharPref("app.update.channel",
+ AppConstants.MOZ_UPDATE_CHANNEL);
let defaults = Services.prefs.getDefaultBranch(null);
- try {
- channel = defaults.getCharPref("app.update.channel");
- } catch (e) {
- // use default value when pref not found
- }
if (aIncludePartners) {
try {
@@ -93,15 +89,7 @@ this.UpdateUtils = {
/* Get the distribution pref values, from defaults only */
function getDistributionPrefValue(aPrefName) {
- var prefValue = "default";
-
- try {
- prefValue = Services.prefs.getDefaultBranch(null).getCharPref(aPrefName);
- } catch (e) {
- // use default when pref not found
- }
-
- return prefValue;
+ return prefValue = Services.prefs.getDefaultBranch(null).getCharPref(aPrefName, "default");
}
/**
diff --git a/toolkit/modules/secondscreen/SimpleServiceDiscovery.jsm b/toolkit/modules/secondscreen/SimpleServiceDiscovery.jsm
index cf9617ea1..4abc93ad1 100644
--- a/toolkit/modules/secondscreen/SimpleServiceDiscovery.jsm
+++ b/toolkit/modules/secondscreen/SimpleServiceDiscovery.jsm
@@ -186,10 +186,7 @@ var SimpleServiceDiscovery = {
},
_searchFixedDevices: function _searchFixedDevices() {
- let fixedDevices = null;
- try {
- fixedDevices = Services.prefs.getCharPref("browser.casting.fixedDevices");
- } catch (e) {}
+ let fixedDevices = Services.prefs.getCharPref("browser.casting.fixedDevices", "");
if (!fixedDevices) {
return;
diff --git a/toolkit/mozapps/downloads/nsHelperAppDlg.js b/toolkit/mozapps/downloads/nsHelperAppDlg.js
index 58697cc77..27c0fede0 100644
--- a/toolkit/mozapps/downloads/nsHelperAppDlg.js
+++ b/toolkit/mozapps/downloads/nsHelperAppDlg.js
@@ -253,10 +253,7 @@ nsUnknownContentTypeDialog.prototype = {
if (!aForcePrompt) {
// Check to see if the user wishes to auto save to the default download
// folder without prompting. Note that preference might not be set.
- let autodownload = false;
- try {
- autodownload = prefs.getBoolPref(PREF_BD_USEDOWNLOADDIR);
- } catch (e) { }
+ let autodownload = prefs.getBoolPref(PREF_BD_USEDOWNLOADDIR, false);
if (autodownload) {
// Retrieve the user's default download directory
diff --git a/toolkit/mozapps/extensions/AddonManager.jsm b/toolkit/mozapps/extensions/AddonManager.jsm
index 4cd2c3d0a..a48e0034f 100644
--- a/toolkit/mozapps/extensions/AddonManager.jsm
+++ b/toolkit/mozapps/extensions/AddonManager.jsm
@@ -135,12 +135,7 @@ var PrefObserver = {
Services.obs.removeObserver(this, "xpcom-shutdown");
}
else if (aTopic == NS_PREFBRANCH_PREFCHANGE_TOPIC_ID) {
- let debugLogEnabled = false;
- try {
- debugLogEnabled = Services.prefs.getBoolPref(PREF_LOGGING_ENABLED);
- }
- catch (e) {
- }
+ let debugLogEnabled = Services.prefs.getBoolPref(PREF_LOGGING_ENABLED, false);
if (debugLogEnabled) {
parentLogger.level = Log.Level.Debug;
}
@@ -791,11 +786,7 @@ var AddonManagerInternal = {
}
catch (e) { }
- let oldPlatformVersion = null;
- try {
- oldPlatformVersion = Services.prefs.getCharPref(PREF_EM_LAST_PLATFORM_VERSION);
- }
- catch (e) { }
+ let oldPlatformVersion = Services.prefs.getCharPref(PREF_EM_LAST_PLATFORM_VERSION, "");
if (appChanged !== false) {
logger.debug("Application has been upgraded");
@@ -808,40 +799,30 @@ var AddonManagerInternal = {
this.validateBlocklist();
}
- try {
- gCheckCompatibility = Services.prefs.getBoolPref(PREF_EM_CHECK_COMPATIBILITY);
- } catch (e) {}
+ gCheckCompatibility = Services.prefs.getBoolPref(PREF_EM_CHECK_COMPATIBILITY,
+ gCheckCompatibility);
Services.prefs.addObserver(PREF_EM_CHECK_COMPATIBILITY, this, false);
- try {
- gStrictCompatibility = Services.prefs.getBoolPref(PREF_EM_STRICT_COMPATIBILITY);
- } catch (e) {}
+ gStrictCompatibility = Services.prefs.getBoolPref(PREF_EM_STRICT_COMPATIBILITY,
+ gStrictCompatibility);
Services.prefs.addObserver(PREF_EM_STRICT_COMPATIBILITY, this, false);
- try {
- let defaultBranch = Services.prefs.getDefaultBranch("");
- gCheckUpdateSecurityDefault = defaultBranch.getBoolPref(PREF_EM_CHECK_UPDATE_SECURITY);
- } catch(e) {}
+ let defaultBranch = Services.prefs.getDefaultBranch("");
+ gCheckUpdateSecurityDefault = defaultBranch.getBoolPref(PREF_EM_CHECK_UPDATE_SECURITY,
+ gCheckUpdateSecurityDefault);
- try {
- gCheckUpdateSecurity = Services.prefs.getBoolPref(PREF_EM_CHECK_UPDATE_SECURITY);
- } catch (e) {}
+ gCheckUpdateSecurity = Services.prefs.getBoolPref(PREF_EM_CHECK_UPDATE_SECURITY,
+ gCheckUpdateSecurity);
Services.prefs.addObserver(PREF_EM_CHECK_UPDATE_SECURITY, this, false);
- try {
- gUpdateEnabled = Services.prefs.getBoolPref(PREF_EM_UPDATE_ENABLED);
- } catch (e) {}
+ gUpdateEnabled = Services.prefs.getBoolPref(PREF_EM_UPDATE_ENABLED, gUpdateEnabled);
Services.prefs.addObserver(PREF_EM_UPDATE_ENABLED, this, false);
- try {
- gAutoUpdateDefault = Services.prefs.getBoolPref(PREF_EM_AUTOUPDATE_DEFAULT);
- } catch (e) {}
+ gAutoUpdateDefault = Services.prefs.getBoolPref(PREF_EM_AUTOUPDATE_DEFAULT,
+ gAutoUpdateDefault);
Services.prefs.addObserver(PREF_EM_AUTOUPDATE_DEFAULT, this, false);
- let defaultProvidersEnabled = true;
- try {
- defaultProvidersEnabled = Services.prefs.getBoolPref(PREF_DEFAULT_PROVIDERS_ENABLED);
- } catch (e) {}
+ let defaultProvidersEnabled = Services.prefs.getBoolPref(PREF_DEFAULT_PROVIDERS_ENABLED, true);
AddonManagerPrivate.recordSimpleMeasure("default_providers", defaultProvidersEnabled);
// Ensure all default providers have had a chance to register themselves
@@ -1167,11 +1148,7 @@ var AddonManagerInternal = {
switch (aData) {
case PREF_EM_CHECK_COMPATIBILITY: {
let oldValue = gCheckCompatibility;
- try {
- gCheckCompatibility = Services.prefs.getBoolPref(PREF_EM_CHECK_COMPATIBILITY);
- } catch(e) {
- gCheckCompatibility = true;
- }
+ gCheckCompatibility = Services.prefs.getBoolPref(PREF_EM_CHECK_COMPATIBILITY, true);
this.callManagerListeners("onCompatibilityModeChanged");
@@ -1182,11 +1159,7 @@ var AddonManagerInternal = {
}
case PREF_EM_STRICT_COMPATIBILITY: {
let oldValue = gStrictCompatibility;
- try {
- gStrictCompatibility = Services.prefs.getBoolPref(PREF_EM_STRICT_COMPATIBILITY);
- } catch(e) {
- gStrictCompatibility = true;
- }
+ gStrictCompatibility = Services.prefs.getBoolPref(PREF_EM_STRICT_COMPATIBILITY, true);
this.callManagerListeners("onCompatibilityModeChanged");
@@ -1197,11 +1170,7 @@ var AddonManagerInternal = {
}
case PREF_EM_CHECK_UPDATE_SECURITY: {
let oldValue = gCheckUpdateSecurity;
- try {
- gCheckUpdateSecurity = Services.prefs.getBoolPref(PREF_EM_CHECK_UPDATE_SECURITY);
- } catch(e) {
- gCheckUpdateSecurity = true;
- }
+ gCheckUpdateSecurity = Services.prefs.getBoolPref(PREF_EM_CHECK_UPDATE_SECURITY, true);
this.callManagerListeners("onCheckUpdateSecurityChanged");
@@ -1212,22 +1181,14 @@ var AddonManagerInternal = {
}
case PREF_EM_UPDATE_ENABLED: {
let oldValue = gUpdateEnabled;
- try {
- gUpdateEnabled = Services.prefs.getBoolPref(PREF_EM_UPDATE_ENABLED);
- } catch(e) {
- gUpdateEnabled = true;
- }
+ gUpdateEnabled = Services.prefs.getBoolPref(PREF_EM_UPDATE_ENABLED, true);
this.callManagerListeners("onUpdateModeChanged");
break;
}
case PREF_EM_AUTOUPDATE_DEFAULT: {
let oldValue = gAutoUpdateDefault;
- try {
- gAutoUpdateDefault = Services.prefs.getBoolPref(PREF_EM_AUTOUPDATE_DEFAULT);
- } catch(e) {
- gAutoUpdateDefault = true;
- }
+ gAutoUpdateDefault = Services.prefs.getBoolPref(PREF_EM_AUTOUPDATE_DEFAULT, true);
this.callManagerListeners("onUpdateModeChanged");
break;
diff --git a/toolkit/mozapps/extensions/DeferredSave.jsm b/toolkit/mozapps/extensions/DeferredSave.jsm
index 89f82b265..f1537fe4b 100644
--- a/toolkit/mozapps/extensions/DeferredSave.jsm
+++ b/toolkit/mozapps/extensions/DeferredSave.jsm
@@ -64,12 +64,7 @@ var PrefObserver = {
Services.obs.removeObserver(this, "xpcom-shutdown");
}
else if (aTopic == NS_PREFBRANCH_PREFCHANGE_TOPIC_ID) {
- let debugLogEnabled = false;
- try {
- debugLogEnabled = Services.prefs.getBoolPref(PREF_LOGGING_ENABLED);
- }
- catch (e) {
- }
+ let debugLogEnabled = Services.prefs.getBoolPref(PREF_LOGGING_ENABLED, false);
if (debugLogEnabled) {
parentLogger.level = Log.Level.Debug;
}
diff --git a/toolkit/mozapps/extensions/GMPUtils.jsm b/toolkit/mozapps/extensions/GMPUtils.jsm
index 9e41a7a61..a199b4d86 100644
--- a/toolkit/mozapps/extensions/GMPUtils.jsm
+++ b/toolkit/mozapps/extensions/GMPUtils.jsm
@@ -154,13 +154,7 @@ this.GMPPrefs = {
get: function(aKey, aDefaultValue, aPlugin) {
if (aKey === this.KEY_APP_DISTRIBUTION ||
aKey === this.KEY_APP_DISTRIBUTION_VERSION) {
- let prefValue = "default";
- try {
- prefValue = Services.prefs.getDefaultBranch(null).getCharPref(aKey);
- } catch (e) {
- // use default when pref not found
- }
- return prefValue;
+ return Services.prefs.getDefaultBranch(null).getCharPref(aKey, "default");
}
return Preferences.get(this.getPrefKey(aKey, aPlugin), aDefaultValue);
},
diff --git a/toolkit/mozapps/extensions/LightweightThemeManager.jsm b/toolkit/mozapps/extensions/LightweightThemeManager.jsm
index 372a9f3b8..a4cbf3833 100644
--- a/toolkit/mozapps/extensions/LightweightThemeManager.jsm
+++ b/toolkit/mozapps/extensions/LightweightThemeManager.jsm
@@ -49,12 +49,7 @@ this.__defineGetter__("_prefs", function prefsGetter() {
this.__defineGetter__("_maxUsedThemes", function maxUsedThemesGetter() {
delete this._maxUsedThemes;
- try {
- this._maxUsedThemes = _prefs.getIntPref("maxUsedThemes");
- }
- catch (e) {
- this._maxUsedThemes = DEFAULT_MAX_USED_THEMES_COUNT;
- }
+ this._maxUsedThemes = _prefs.getIntPref("maxUsedThemes", DEFAULT_MAX_USED_THEMES_COUNT);
return this._maxUsedThemes;
});
@@ -719,12 +714,8 @@ var _previewTimerCallback = {
function _prefObserver(aSubject, aTopic, aData) {
switch (aData) {
case "maxUsedThemes":
- try {
- _maxUsedThemes = _prefs.getIntPref(aData);
- }
- catch (e) {
- _maxUsedThemes = DEFAULT_MAX_USED_THEMES_COUNT;
- }
+ _maxUsedThemes = _prefs.getIntPref(aData, DEFAULT_MAX_USED_THEMES_COUNT);
+
// Update the theme list to remove any themes over the number we keep
_updateUsedThemes(LightweightThemeManager.usedThemes);
break;
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) {