summaryrefslogtreecommitdiffstats
path: root/toolkit/components/search
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/components/search')
-rw-r--r--toolkit/components/search/current/nsSearchService.js38
-rw-r--r--toolkit/components/search/orginal/nsSearchService.js38
2 files changed, 20 insertions, 56 deletions
diff --git a/toolkit/components/search/current/nsSearchService.js b/toolkit/components/search/current/nsSearchService.js
index 2a8601078..66866540a 100644
--- a/toolkit/components/search/current/nsSearchService.js
+++ b/toolkit/components/search/current/nsSearchService.js
@@ -390,12 +390,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:
@@ -500,11 +495,7 @@ function isUSTimezone() {
// If it fails we don't touch that pref so isUS() does its normal thing.
var ensureKnownCountryCode = Task.async(function* (ss) {
// 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
@@ -726,10 +717,7 @@ var fetchRegionDefault = (ss) => 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;
@@ -993,19 +981,13 @@ function QueryParameter(aName, aValue, aPurpose) {
function ParamSubstitution(aParamValue, aSearchTerms, aEngine) {
var value = aParamValue;
- var distributionID = Services.appinfo.distributionID;
- try {
- distributionID = Services.prefs.getCharPref(BROWSER_SEARCH_PREF + "distributionID");
- }
- catch (ex) { }
- var official = MOZ_OFFICIAL;
- try {
- if (Services.prefs.getBoolPref(BROWSER_SEARCH_PREF + "official"))
- official = "official";
- else
- official = "unofficial";
- }
- catch (ex) { }
+ var distributionID = Services.prefs.getCharPref(BROWSER_SEARCH_PREF + "distributionID",
+ Services.appinfo.distributionID || "");
+ var official;
+ if (Services.prefs.getBoolPref(BROWSER_SEARCH_PREF + "official", MOZ_OFFICIAL))
+ official = "official";
+ else
+ official = "unofficial";
// Custom search parameters. These are only available to default search
// engines.
diff --git a/toolkit/components/search/orginal/nsSearchService.js b/toolkit/components/search/orginal/nsSearchService.js
index 5b5ce7a57..c4481df5f 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,19 +1022,13 @@ 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 official = MOZ_OFFICIAL;
- try {
- if (Services.prefs.getBoolPref(BROWSER_SEARCH_PREF + "official"))
- official = "official";
- else
- official = "unofficial";
- }
- catch (ex) { }
+ var distributionID = Services.prefs.getCharPref(BROWSER_SEARCH_PREF + "distributionID",
+ MOZ_DISTRIBUTION_ID || "");
+ var official;
+ if (Services.prefs.getBoolPref(BROWSER_SEARCH_PREF + "official", MOZ_OFFICIAL))
+ official = "official";
+ else
+ official = "unofficial";
// Custom search parameters. These are only available to default search
// engines.