diff options
author | Ascrod <32915892+Ascrod@users.noreply.github.com> | 2019-04-13 10:53:58 -0400 |
---|---|---|
committer | Ascrod <32915892+Ascrod@users.noreply.github.com> | 2019-04-13 11:37:45 -0400 |
commit | 714e9c9074d9eb2f4063962d07bae6b4f02a1e7a (patch) | |
tree | a1ce0e95383947c2cd5f3b514c2e736240d876f8 /toolkit/components/places | |
parent | 2d3b7717ae8ddfa5e6561cff5d6daa7f80a939e5 (diff) | |
download | UXP-714e9c9074d9eb2f4063962d07bae6b4f02a1e7a.tar UXP-714e9c9074d9eb2f4063962d07bae6b4f02a1e7a.tar.gz UXP-714e9c9074d9eb2f4063962d07bae6b4f02a1e7a.tar.lz UXP-714e9c9074d9eb2f4063962d07bae6b4f02a1e7a.tar.xz UXP-714e9c9074d9eb2f4063962d07bae6b4f02a1e7a.zip |
Issue #991 Part 7: Toolkit Components
Diffstat (limited to 'toolkit/components/places')
5 files changed, 10 insertions, 32 deletions
diff --git a/toolkit/components/places/PlacesCategoriesStarter.js b/toolkit/components/places/PlacesCategoriesStarter.js index 560bd486a..bab14db52 100644 --- a/toolkit/components/places/PlacesCategoriesStarter.js +++ b/toolkit/components/places/PlacesCategoriesStarter.js @@ -77,11 +77,8 @@ PlacesCategoriesStarter.prototype = { break; case "idle-daily": // Once a week run places.sqlite maintenance tasks. - let lastMaintenance = 0; - try { - lastMaintenance = - Services.prefs.getIntPref("places.database.lastMaintenance"); - } catch (ex) {} + let lastMaintenance = + Services.prefs.getIntPref("places.database.lastMaintenance", 0); let nowSeconds = parseInt(Date.now() / 1000); if (lastMaintenance < nowSeconds - MAINTENANCE_INTERVAL_SECONDS) { PlacesDBUtils.maintenanceOnIdle(); diff --git a/toolkit/components/places/PlacesRemoteTabsAutocompleteProvider.jsm b/toolkit/components/places/PlacesRemoteTabsAutocompleteProvider.jsm index d23d5bc6e..c3bc501eb 100644 --- a/toolkit/components/places/PlacesRemoteTabsAutocompleteProvider.jsm +++ b/toolkit/components/places/PlacesRemoteTabsAutocompleteProvider.jsm @@ -95,11 +95,7 @@ function observe(subject, topic, data) { case "nsPref:changed": if (data == PREF_SHOW_REMOTE_ICONS) { - try { - showRemoteIcons = Services.prefs.getBoolPref(PREF_SHOW_REMOTE_ICONS); - } catch (_) { - showRemoteIcons = true; // no such pref - default is to show the icons. - } + showRemoteIcons = Services.prefs.getBoolPref(PREF_SHOW_REMOTE_ICONS, true); } break; diff --git a/toolkit/components/places/UnifiedComplete.js b/toolkit/components/places/UnifiedComplete.js index ec5f91111..7b63e29bb 100644 --- a/toolkit/components/places/UnifiedComplete.js +++ b/toolkit/components/places/UnifiedComplete.js @@ -437,10 +437,7 @@ XPCOMUtils.defineLazyGetter(this, "Prefs", () => { store.suggestTyped = prefs.get(...PREF_SUGGEST_HISTORY_ONLYTYPED); store.suggestSearches = prefs.get(...PREF_SUGGEST_SEARCHES); store.maxCharsForSearchSuggestions = prefs.get(...PREF_MAX_CHARS_FOR_SUGGEST); - store.keywordEnabled = true; - try { - store.keywordEnabled = Services.prefs.getBoolPref("keyword.enabled"); - } catch (ex) {} + store.keywordEnabled = Services.prefs.getBoolPref("keyword.enabled", true); // If history is not set, onlyTyped value should be ignored. if (!store.suggestHistory) { diff --git a/toolkit/components/places/nsPlacesExpiration.js b/toolkit/components/places/nsPlacesExpiration.js index 499934362..767a4d345 100644 --- a/toolkit/components/places/nsPlacesExpiration.js +++ b/toolkit/components/places/nsPlacesExpiration.js @@ -812,11 +812,8 @@ nsPlacesExpiration.prototype = { _loadPrefs: Task.async(function* () { // Get the user's limit, if it was set. - try { - // We want to silently fail since getIntPref throws if it does not exist, - // and use a default to fallback to. - this._urisLimit = this._prefBranch.getIntPref(PREF_MAX_URIS); - } catch (ex) { /* User limit not set */ } + this._urisLimit = this._prefBranch.getIntPref(PREF_MAX_URIS, + PREF_MAX_URIS_NOTSET); if (this._urisLimit < 0) { // Some testing code expects a pref change to be synchronous, so @@ -874,11 +871,8 @@ nsPlacesExpiration.prototype = { this._urisLimit); // Get the expiration interval value. - try { - // We want to silently fail since getIntPref throws if it does not exist, - // and use a default to fallback to. - this._interval = this._prefBranch.getIntPref(PREF_INTERVAL_SECONDS); - } catch (ex) { /* User interval not set */ } + this._interval = this._prefBranch.getIntPref(PREF_INTERVAL_SECONDS, + PREF_INTERVAL_SECONDS_NOTSET); if (this._interval <= 0) { this._interval = PREF_INTERVAL_SECONDS_NOTSET; } diff --git a/toolkit/components/places/tests/unit/test_000_frecency.js b/toolkit/components/places/tests/unit/test_000_frecency.js index 0a7347a02..64ee86b59 100644 --- a/toolkit/components/places/tests/unit/test_000_frecency.js +++ b/toolkit/components/places/tests/unit/test_000_frecency.js @@ -56,14 +56,8 @@ var prefPrefix = "places.frecency."; function* task_initializeBucket(bucket) { let [cutoffName, weightName] = bucket; // get pref values - var weight = 0, cutoff = 0; - try { - weight = prefs.getIntPref(prefPrefix + weightName); - } catch (ex) {} - try { - cutoff = prefs.getIntPref(prefPrefix + cutoffName); - } catch (ex) {} - + var weight = prefs.getIntPref(prefPrefix + weightName, 0); + var cutoff = prefs.getIntPref(prefPrefix + cutoffName, 0); if (cutoff < 1) return; |