diff options
author | Moonchild <mcwerewolf@wolfbeast.com> | 2019-04-20 11:17:30 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-20 11:17:30 +0200 |
commit | e0116ac2b78eb4e621a4d0769e01f8358a6d661c (patch) | |
tree | fe2898874f0be34a8425281ecba2cb8cb59fb210 /toolkit/modules | |
parent | 32577bdb3d2471c0e5ce4cfd0501a820157230cb (diff) | |
parent | 21b4cb27cabecdb5580c01891801c9259689ec87 (diff) | |
download | UXP-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/modules')
-rw-r--r-- | toolkit/modules/NewTabUtils.jsm | 20 | ||||
-rw-r--r-- | toolkit/modules/PermissionsUtils.jsm | 5 | ||||
-rw-r--r-- | toolkit/modules/UpdateUtils.jsm | 18 | ||||
-rw-r--r-- | toolkit/modules/secondscreen/SimpleServiceDiscovery.jsm | 5 |
4 files changed, 13 insertions, 35 deletions
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; |