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 /application/basilisk/components/customizableui/CustomizableUI.jsm | |
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 'application/basilisk/components/customizableui/CustomizableUI.jsm')
-rw-r--r-- | application/basilisk/components/customizableui/CustomizableUI.jsm | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/application/basilisk/components/customizableui/CustomizableUI.jsm b/application/basilisk/components/customizableui/CustomizableUI.jsm index 31126b37c..d56d63d99 100644 --- a/application/basilisk/components/customizableui/CustomizableUI.jsm +++ b/application/basilisk/components/customizableui/CustomizableUI.jsm @@ -158,10 +158,7 @@ var gUIStateBeforeReset = { XPCOMUtils.defineLazyGetter(this, "log", () => { let scope = {}; Cu.import("resource://gre/modules/Console.jsm", scope); - let debug; - try { - debug = Services.prefs.getBoolPref(kPrefCustomizationDebug); - } catch (ex) {} + let debug = Services.prefs.getBoolPref(kPrefCustomizationDebug, false); let consoleOptions = { maxLogLevel: debug ? "all" : "log", prefix: "CustomizableUI", @@ -1914,16 +1911,10 @@ var CustomizableUIInternal = { // state immediately when a browser window opens, which is important for // other consumers of this API. loadSavedState: function() { - let state = null; - try { - state = Services.prefs.getCharPref(kPrefCustomizationState); - } catch (e) { - log.debug("No saved state found"); - // This will fail if nothing has been customized, so silently fall back to - // the defaults. - } - + let state = Services.prefs.getCharPref(kPrefCustomizationState, ""); if (!state) { + log.debug("No saved state found"); + // Nothing has been customized, so silently fall back to the defaults. return; } try { @@ -2208,10 +2199,7 @@ var CustomizableUIInternal = { this.notifyListeners("onWidgetAdded", widget.id, widget.currentArea, widget.currentPosition); } else if (widgetMightNeedAutoAdding) { - let autoAdd = true; - try { - autoAdd = Services.prefs.getBoolPref(kPrefCustomizationAutoAdd); - } catch (e) {} + let autoAdd = Services.prefs.getBoolPref(kPrefCustomizationAutoAdd, true); // If the widget doesn't have an existing placement, and it hasn't been // seen before, then add it to its default area so it can be used. |