From 8757548a3e5b5cc4d159d61eb4a12c7af1be548e Mon Sep 17 00:00:00 2001 From: Ascrod <32915892+Ascrod@users.noreply.github.com> Date: Sat, 13 Apr 2019 11:22:15 -0400 Subject: Issue #991 Part 8: Toolkit everything else --- toolkit/content/widgets/browser.xml | 23 +------ toolkit/content/widgets/preferences.xml | 8 +-- toolkit/content/widgets/scrollbox.xml | 27 ++------ toolkit/modules/NewTabUtils.jsm | 20 +++--- toolkit/modules/PermissionsUtils.jsm | 5 +- toolkit/modules/UpdateUtils.jsm | 18 +---- .../secondscreen/SimpleServiceDiscovery.jsm | 5 +- toolkit/mozapps/downloads/nsHelperAppDlg.js | 5 +- toolkit/mozapps/extensions/AddonManager.jsm | 79 ++++++---------------- toolkit/mozapps/extensions/DeferredSave.jsm | 7 +- toolkit/mozapps/extensions/GMPUtils.jsm | 8 +-- .../mozapps/extensions/LightweightThemeManager.jsm | 15 +--- .../mozapps/extensions/internal/AddonLogging.jsm | 7 +- .../extensions/internal/AddonRepository.jsm | 32 ++------- .../extensions/internal/AddonUpdateChecker.jsm | 14 +--- .../extensions/internal/XPIProviderUtils.js | 5 +- 16 files changed, 62 insertions(+), 216 deletions(-) (limited to 'toolkit') diff --git a/toolkit/content/widgets/browser.xml b/toolkit/content/widgets/browser.xml index 9c72e86d88..11ed998cca 100644 --- a/toolkit/content/widgets/browser.xml +++ b/toolkit/content/widgets/browser.xml @@ -19,14 +19,7 @@ if (this.getAttribute("autoscroll") == "false") return false; - var enabled = true; - try { - enabled = this.mPrefs.getBoolPref("general.autoScroll"); - } - catch (ex) { - } - - return enabled; + return this.mPrefs.getBoolPref("general.autoScroll", true); ]]> @@ -1427,18 +1420,8 @@ return; // Toggle browse with caret mode - var browseWithCaretOn = false; - var warn = true; - - try { - warn = this.mPrefs.getBoolPref(kPrefWarnOnEnable); - } catch (ex) { - } - - try { - browseWithCaretOn = this.mPrefs.getBoolPref(kPrefCaretBrowsingOn); - } catch (ex) { - } + var browseWithCaretOn = this.mPrefs.getBoolPref(kPrefCaretBrowsingOn, false); + var warn = this.mPrefs.getBoolPref(kPrefWarnOnEnable, true); if (warn && !browseWithCaretOn) { var checkValue = {value:false}; var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] diff --git a/toolkit/content/widgets/preferences.xml b/toolkit/content/widgets/preferences.xml index 9fb2ac7ea1..11de032462 100644 --- a/toolkit/content/widgets/preferences.xml +++ b/toolkit/content/widgets/preferences.xml @@ -893,12 +893,8 @@ diff --git a/toolkit/content/widgets/scrollbox.xml b/toolkit/content/widgets/scrollbox.xml index ff57a59114..219b7cb5e4 100644 --- a/toolkit/content/widgets/scrollbox.xml +++ b/toolkit/content/widgets/scrollbox.xml @@ -80,13 +80,8 @@ @@ -99,13 +94,8 @@ if (this.hasAttribute("smoothscroll")) { this._smoothScroll = (this.getAttribute("smoothscroll") == "true"); } else { - try { - this._smoothScroll = this._prefBranch - .getBoolPref("toolkit.scrollbox.smoothScroll"); - } - catch (ex) { - this._smoothScroll = true; - } + this._smoothScroll = this._prefBranch + .getBoolPref("toolkit.scrollbox.smoothScroll", true); } } return this._smoothScroll; @@ -737,12 +727,9 @@ threshold); }, @@ -1543,10 +1530,8 @@ this.AddonRepository = { // Create url from preference, returning null if preference does not exist _formatURLPref: function AddonRepo_formatURLPref(aPreference, aSubstitutions) { - let url = null; - try { - url = Services.prefs.getCharPref(aPreference); - } catch(e) { + let url = Services.prefs.getCharPref(aPreference, ""); + if (!url) { logger.warn("_formatURLPref: Couldn't get pref: " + aPreference); return null; } @@ -1639,10 +1624,7 @@ var AddonDatabase = { // Create a blank addons.json file this._saveDBToDisk(); - let dbSchema = 0; - try { - dbSchema = Services.prefs.getIntPref(PREF_GETADDONS_DB_SCHEMA); - } catch (e) {} + let dbSchema = Services.prefs.getIntPref(PREF_GETADDONS_DB_SCHEMA, 0); if (dbSchema < DB_MIN_JSON_SCHEMA) { let results = yield new Promise((resolve, reject) => { diff --git a/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm b/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm index c06dca1d53..a475f7f1fa 100644 --- a/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm +++ b/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm @@ -608,12 +608,7 @@ function UpdateParser(aId, aUpdateKey, aUrl, aObserver) { this.observer = aObserver; this.url = aUrl; - let requireBuiltIn = true; - try { - requireBuiltIn = Services.prefs.getBoolPref(PREF_UPDATE_REQUIREBUILTINCERTS); - } - catch (e) { - } + let requireBuiltIn = Services.prefs.getBoolPref(PREF_UPDATE_REQUIREBUILTINCERTS, true); logger.debug("Requesting " + aUrl); try { @@ -651,12 +646,7 @@ UpdateParser.prototype = { this.request = null; this._doneAt = new Error("place holder"); - let requireBuiltIn = true; - try { - requireBuiltIn = Services.prefs.getBoolPref(PREF_UPDATE_REQUIREBUILTINCERTS); - } - catch (e) { - } + let requireBuiltIn = Services.prefs.getBoolPref(PREF_UPDATE_REQUIREBUILTINCERTS, true); try { CertUtils.checkCert(request.channel, !requireBuiltIn); diff --git a/toolkit/mozapps/extensions/internal/XPIProviderUtils.js b/toolkit/mozapps/extensions/internal/XPIProviderUtils.js index f2420bd1ac..69d774e4a0 100644 --- a/toolkit/mozapps/extensions/internal/XPIProviderUtils.js +++ b/toolkit/mozapps/extensions/internal/XPIProviderUtils.js @@ -1410,10 +1410,7 @@ this.XPIDatabase = { // when a lightweight theme is applied for example) text += "\r\n[ThemeDirs]\r\n"; - let dssEnabled = false; - try { - dssEnabled = Services.prefs.getBoolPref(PREF_EM_DSS_ENABLED); - } catch (e) {} + let dssEnabled = Services.prefs.getBoolPref(PREF_EM_DSS_ENABLED, false); let themes = []; if (dssEnabled) { -- cgit v1.2.3