summaryrefslogtreecommitdiffstats
path: root/toolkit/components/search/orginal/nsSearchService.js
diff options
context:
space:
mode:
authorMoonchild <mcwerewolf@wolfbeast.com>2019-04-20 11:17:30 +0200
committerGitHub <noreply@github.com>2019-04-20 11:17:30 +0200
commite0116ac2b78eb4e621a4d0769e01f8358a6d661c (patch)
treefe2898874f0be34a8425281ecba2cb8cb59fb210 /toolkit/components/search/orginal/nsSearchService.js
parent32577bdb3d2471c0e5ce4cfd0501a820157230cb (diff)
parent21b4cb27cabecdb5580c01891801c9259689ec87 (diff)
downloadUXP-e0116ac2b78eb4e621a4d0769e01f8358a6d661c.tar
UXP-e0116ac2b78eb4e621a4d0769e01f8358a6d661c.tar.gz
UXP-e0116ac2b78eb4e621a4d0769e01f8358a6d661c.tar.lz
UXP-e0116ac2b78eb4e621a4d0769e01f8358a6d661c.tar.xz
UXP-e0116ac2b78eb4e621a4d0769e01f8358a6d661c.zip
Merge pull request #1041 from Ascrod/default-pref
Clean up try/catch blocks for preferences
Diffstat (limited to 'toolkit/components/search/orginal/nsSearchService.js')
-rw-r--r--toolkit/components/search/orginal/nsSearchService.js25
1 files changed, 5 insertions, 20 deletions
diff --git a/toolkit/components/search/orginal/nsSearchService.js b/toolkit/components/search/orginal/nsSearchService.js
index 5b5ce7a57..1cec5f966 100644
--- a/toolkit/components/search/orginal/nsSearchService.js
+++ b/toolkit/components/search/orginal/nsSearchService.js
@@ -418,12 +418,7 @@ function isPartnerBuild() {
// Method to determine if we should be using geo-specific defaults
function geoSpecificDefaultsEnabled() {
- let geoSpecificDefaults = false;
- try {
- geoSpecificDefaults = Services.prefs.getBoolPref("browser.search.geoSpecificDefaults");
- } catch(e) {}
-
- return geoSpecificDefaults;
+ return Services.prefs.getBoolPref("browser.search.geoSpecificDefaults", false);
}
// Some notes on countryCode and region prefs:
@@ -528,11 +523,7 @@ function isUSTimezone() {
// If it fails we don't touch that pref so isUS() does its normal thing.
var ensureKnownCountryCode = Task.async(function* () {
// If we have a country-code already stored in our prefs we trust it.
- let countryCode;
- try {
- countryCode = Services.prefs.getCharPref("browser.search.countryCode");
- } catch(e) {}
-
+ let countryCode = Services.prefs.getCharPref("browser.search.countryCode", "");
if (!countryCode) {
// We don't have it cached, so fetch it. fetchCountryCode() will call
// storeCountryCode if it gets a result (even if that happens after the
@@ -732,10 +723,7 @@ var fetchRegionDefault = () => new Promise(resolve => {
// Append the optional cohort value.
const cohortPref = "browser.search.cohort";
- let cohort;
- try {
- cohort = Services.prefs.getCharPref(cohortPref);
- } catch(e) {}
+ let cohort = Services.prefs.getCharPref(cohortPref, "");
if (cohort)
endpoint += "/" + cohort;
@@ -1034,11 +1022,8 @@ function QueryParameter(aName, aValue, aPurpose) {
function ParamSubstitution(aParamValue, aSearchTerms, aEngine) {
var value = aParamValue;
- var distributionID = MOZ_DISTRIBUTION_ID;
- try {
- distributionID = Services.prefs.getCharPref(BROWSER_SEARCH_PREF + "distributionID");
- }
- catch (ex) { }
+ var distributionID = Services.prefs.getCharPref(BROWSER_SEARCH_PREF + "distributionID",
+ MOZ_DISTRIBUTION_ID || "");
var official = MOZ_OFFICIAL;
try {
if (Services.prefs.getBoolPref(BROWSER_SEARCH_PREF + "official"))