From 7591326915a100b54ca17ad6fedb391645bac6b5 Mon Sep 17 00:00:00 2001 From: Ascrod <32915892+Ascrod@users.noreply.github.com> Date: Mon, 8 Apr 2019 19:58:00 -0400 Subject: Issue #991 Part 2: Basilisk --- .../components/customizableui/CustomizableUI.jsm | 22 +++++----------------- .../customizableui/CustomizableWidgets.jsm | 5 +---- .../components/customizableui/CustomizeMode.jsm | 9 ++------- 3 files changed, 8 insertions(+), 28 deletions(-) (limited to 'application/basilisk/components/customizableui') diff --git a/application/basilisk/components/customizableui/CustomizableUI.jsm b/application/basilisk/components/customizableui/CustomizableUI.jsm index cb0f519b2..be274da71 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", @@ -1915,16 +1912,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 { @@ -2209,10 +2200,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. diff --git a/application/basilisk/components/customizableui/CustomizableWidgets.jsm b/application/basilisk/components/customizableui/CustomizableWidgets.jsm index 401b7ca74..53812762d 100644 --- a/application/basilisk/components/customizableui/CustomizableWidgets.jsm +++ b/application/basilisk/components/customizableui/CustomizableWidgets.jsm @@ -40,10 +40,7 @@ const kWidePanelItemClass = "panel-wide-item"; 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: "CustomizableWidgets", diff --git a/application/basilisk/components/customizableui/CustomizeMode.jsm b/application/basilisk/components/customizableui/CustomizeMode.jsm index 4365ddfbc..2958655d2 100644 --- a/application/basilisk/components/customizableui/CustomizeMode.jsm +++ b/application/basilisk/components/customizableui/CustomizeMode.jsm @@ -40,9 +40,7 @@ let gDebug; XPCOMUtils.defineLazyGetter(this, "log", () => { let scope = {}; Cu.import("resource://gre/modules/Console.jsm", scope); - try { - gDebug = Services.prefs.getBoolPref(kPrefCustomizationDebug); - } catch (ex) {} + gDebug = Services.prefs.getBoolPref(kPrefCustomizationDebug, false); let consoleOptions = { maxLogLevel: gDebug ? "all" : "log", prefix: "CustomizeMode", @@ -1503,10 +1501,7 @@ CustomizeMode.prototype = { if (!AppConstants.CAN_DRAW_IN_TITLEBAR) { return; } - let drawInTitlebar = true; - try { - drawInTitlebar = Services.prefs.getBoolPref(kDrawInTitlebarPref); - } catch (ex) { } + let drawInTitlebar = Services.prefs.getBoolPref(kDrawInTitlebarPref, true); let button = this.document.getElementById("customization-titlebar-visibility-button"); // Drawing in the titlebar means 'hiding' the titlebar: if (drawInTitlebar) { -- cgit v1.2.3