summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
authorMoonchild <mcwerewolf@wolfbeast.com>2019-04-20 11:17:30 +0200
committerGitHub <noreply@github.com>2019-04-20 11:17:30 +0200
commite0116ac2b78eb4e621a4d0769e01f8358a6d661c (patch)
treefe2898874f0be34a8425281ecba2cb8cb59fb210 /application
parent32577bdb3d2471c0e5ce4cfd0501a820157230cb (diff)
parent21b4cb27cabecdb5580c01891801c9259689ec87 (diff)
downloadUXP-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')
-rw-r--r--application/basilisk/base/content/browser-syncui.js6
-rw-r--r--application/basilisk/base/content/browser.js10
-rw-r--r--application/basilisk/base/content/tabbrowser.xml12
-rw-r--r--application/basilisk/components/customizableui/CustomizableUI.jsm22
-rw-r--r--application/basilisk/components/customizableui/CustomizableWidgets.jsm5
-rw-r--r--application/basilisk/components/customizableui/CustomizeMode.jsm9
-rw-r--r--application/basilisk/components/distribution.js19
-rw-r--r--application/basilisk/components/feeds/FeedWriter.js7
-rw-r--r--application/basilisk/components/feeds/WebContentConverter.js9
-rw-r--r--application/basilisk/components/nsBrowserContentHandler.js15
-rw-r--r--application/basilisk/components/nsBrowserGlue.js33
-rw-r--r--application/basilisk/components/sync/aboutSyncTabs.js8
-rw-r--r--application/basilisk/modules/DirectoryLinksProvider.jsm6
-rw-r--r--application/palemoon/base/content/browser-syncui.js11
-rw-r--r--application/palemoon/base/content/tabbrowser.xml6
-rw-r--r--application/palemoon/components/distribution.js14
-rw-r--r--application/palemoon/components/feeds/FeedWriter.js19
-rw-r--r--application/palemoon/components/feeds/WebContentConverter.js9
-rw-r--r--application/palemoon/components/nsBrowserContentHandler.js15
-rw-r--r--application/palemoon/components/nsBrowserGlue.js15
20 files changed, 47 insertions, 203 deletions
diff --git a/application/basilisk/base/content/browser-syncui.js b/application/basilisk/base/content/browser-syncui.js
index 67056e221..d0f46247a 100644
--- a/application/basilisk/base/content/browser-syncui.js
+++ b/application/basilisk/base/content/browser-syncui.js
@@ -83,10 +83,7 @@ var gSyncUI = {
_wasDelayed: false,
_needsSetup: function SUI__needsSetup() {
- let firstSync = "";
- try {
- firstSync = Services.prefs.getCharPref("services.sync.firstSync");
- } catch (e) { }
+ let firstSync = Services.prefs.getCharPref("services.sync.firstSync", "");
return Weave.Status.checkSetup() == Weave.CLIENT_NOT_CONFIGURED ||
firstSync == "notReady";
},
@@ -275,7 +272,6 @@ var gSyncUI = {
openPreferences("paneSync");
},
-
// Helpers
_updateLastSyncTime: function SUI__updateLastSyncTime() {
if (!gBrowser)
diff --git a/application/basilisk/base/content/browser.js b/application/basilisk/base/content/browser.js
index a752f4cd9..926a369dd 100644
--- a/application/basilisk/base/content/browser.js
+++ b/application/basilisk/base/content/browser.js
@@ -2589,15 +2589,9 @@ var gMenuButtonUpdateBadge = {
cancelObserverRegistered: false,
init: function () {
- try {
- this.enabled = Services.prefs.getBoolPref("app.update.badge");
- } catch (e) {}
+ this.enabled = Services.prefs.getBoolPref("app.update.badge", false);
if (this.enabled) {
- try {
- this.badgeWaitTime = Services.prefs.getIntPref("app.update.badgeWaitTime");
- } catch (e) {
- this.badgeWaitTime = 345600; // 4 days
- }
+ this.badgeWaitTime = Services.prefs.getIntPref("app.update.badgeWaitTime", 345600); // 4 days
Services.obs.addObserver(this, "update-staged", false);
Services.obs.addObserver(this, "update-downloaded", false);
}
diff --git a/application/basilisk/base/content/tabbrowser.xml b/application/basilisk/base/content/tabbrowser.xml
index c2f02512d..0e819a3ed 100644
--- a/application/basilisk/base/content/tabbrowser.xml
+++ b/application/basilisk/base/content/tabbrowser.xml
@@ -4135,11 +4135,7 @@
return true;
if (this._logInit)
return this._shouldLog;
- let result = false;
- try {
- result = Services.prefs.getBoolPref("browser.tabs.remote.logSwitchTiming");
- } catch (ex) {
- }
+ let result = Services.prefs.getBoolPref("browser.tabs.remote.logSwitchTiming", false);
this._shouldLog = result;
this._logInit = true;
return this._shouldLog;
@@ -5208,11 +5204,7 @@
window.addEventListener("resize", this, false);
window.addEventListener("load", this, false);
- try {
- this._tabAnimationLoggingEnabled = Services.prefs.getBoolPref("browser.tabs.animationLogging.enabled");
- } catch (ex) {
- this._tabAnimationLoggingEnabled = false;
- }
+ this._tabAnimationLoggingEnabled = Services.prefs.getBoolPref("browser.tabs.animationLogging.enabled", false);
this._browserNewtabpageEnabled = Services.prefs.getBoolPref("browser.newtabpage.enabled");
]]>
</constructor>
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.
diff --git a/application/basilisk/components/customizableui/CustomizableWidgets.jsm b/application/basilisk/components/customizableui/CustomizableWidgets.jsm
index 9e8f0ec78..d4a191a97 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) {
diff --git a/application/basilisk/components/distribution.js b/application/basilisk/components/distribution.js
index 589129a5a..c30e4dcfe 100644
--- a/application/basilisk/components/distribution.js
+++ b/application/basilisk/components/distribution.js
@@ -22,10 +22,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
this.DistributionCustomizer = function DistributionCustomizer() {
// For parallel xpcshell testing purposes allow loading the distribution.ini
// file from the profile folder through an hidden pref.
- let loadFromProfile = false;
- try {
- loadFromProfile = Services.prefs.getBoolPref("distribution.testing.loadFromProfile");
- } catch (ex) {}
+ loadFromProfile = Services.prefs.getBoolPref("distribution.testing.loadFromProfile", false);
let dirSvc = Cc["@mozilla.org/file/directory_service;1"].
getService(Ci.nsIProperties);
try {
@@ -60,13 +57,7 @@ DistributionCustomizer.prototype = {
},
get _locale() {
- let locale;
- try {
- locale = this._prefs.getCharPref("general.useragent.locale");
- }
- catch (e) {
- locale = "en-US";
- }
+ let locale = this._prefs.getCharPref("general.useragent.locale", "en-US");
this.__defineGetter__("_locale", () => locale);
return this._locale;
},
@@ -291,11 +282,7 @@ DistributionCustomizer.prototype = {
this._ini.getString("Global", "id") + ".bookmarksProcessed";
}
- let bmProcessed = false;
- try {
- bmProcessed = this._prefs.getBoolPref(bmProcessedPref);
- }
- catch (e) {}
+ let bmProcessed = this._prefs.getBoolPref(bmProcessedPref, false);
if (!bmProcessed) {
if (sections["BookmarksMenu"])
diff --git a/application/basilisk/components/feeds/FeedWriter.js b/application/basilisk/components/feeds/FeedWriter.js
index 20f1399b0..ceb2a7e2f 100644
--- a/application/basilisk/components/feeds/FeedWriter.js
+++ b/application/basilisk/components/feeds/FeedWriter.js
@@ -19,12 +19,7 @@ function LOG(str) {
let prefB = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch);
- let shouldLog = false;
- try {
- shouldLog = prefB.getBoolPref("feeds.log");
- }
- catch (ex) {
- }
+ let shouldLog = prefB.getBoolPref("feeds.log", false);
if (shouldLog)
dump("*** Feeds: " + str + "\n");
diff --git a/application/basilisk/components/feeds/WebContentConverter.js b/application/basilisk/components/feeds/WebContentConverter.js
index 2cb5cd145..159eca7c2 100644
--- a/application/basilisk/components/feeds/WebContentConverter.js
+++ b/application/basilisk/components/feeds/WebContentConverter.js
@@ -187,13 +187,8 @@ const Utils = {
// check if it is in the black list
let pb = Services.prefs;
- let allowed;
- try {
- allowed = pb.getBoolPref(PREF_HANDLER_EXTERNAL_PREFIX + "." + aProtocol);
- }
- catch (e) {
- allowed = pb.getBoolPref(PREF_HANDLER_EXTERNAL_PREFIX + "-default");
- }
+ let allowed = pb.getBoolPref(PREF_HANDLER_EXTERNAL_PREFIX + "." + aProtocol,
+ pb.getBoolPref(PREF_HANDLER_EXTERNAL_PREFIX + "-default"));
if (!allowed) {
throw this.getSecurityError(
`Not allowed to register a protocol handler for ${aProtocol}`,
diff --git a/application/basilisk/components/nsBrowserContentHandler.js b/application/basilisk/components/nsBrowserContentHandler.js
index 74144fc1b..d65e52594 100644
--- a/application/basilisk/components/nsBrowserContentHandler.js
+++ b/application/basilisk/components/nsBrowserContentHandler.js
@@ -100,20 +100,14 @@ const OVERRIDE_NEW_BUILD_ID = 3;
* OVERRIDE_NONE otherwise.
*/
function needHomepageOverride(prefb) {
- var savedmstone = null;
- try {
- savedmstone = prefb.getCharPref("browser.startup.homepage_override.mstone");
- } catch (e) {}
+ var savedmstone = prefb.getCharPref("browser.startup.homepage_override.mstone", "");
if (savedmstone == "ignore")
return OVERRIDE_NONE;
var mstone = Services.appinfo.platformVersion;
- var savedBuildID = null;
- try {
- savedBuildID = prefb.getCharPref("browser.startup.homepage_override.buildID");
- } catch (e) {}
+ var savedBuildID = prefb.getCharPref("browser.startup.homepage_override.buildID", "");
var buildID = Services.appinfo.platformBuildID;
@@ -489,10 +483,7 @@ nsBrowserContentHandler.prototype = {
// URL if we do end up showing an overridePage. This makes it possible
// to have the overridePage's content vary depending on the version we're
// upgrading from.
- let old_mstone = "unknown";
- try {
- old_mstone = Services.prefs.getCharPref("browser.startup.homepage_override.mstone");
- } catch (ex) {}
+ let old_mstone = Services.prefs.getCharPref("browser.startup.homepage_override.mstone", "unknown");
override = needHomepageOverride(prefb);
if (override != OVERRIDE_NONE) {
switch (override) {
diff --git a/application/basilisk/components/nsBrowserGlue.js b/application/basilisk/components/nsBrowserGlue.js
index 82de33240..b4256523f 100644
--- a/application/basilisk/components/nsBrowserGlue.js
+++ b/application/basilisk/components/nsBrowserGlue.js
@@ -961,10 +961,7 @@ BrowserGlue.prototype = {
// Offer to reset a user's profile if it hasn't been used for 60 days.
const OFFER_PROFILE_RESET_INTERVAL_MS = 60 * 24 * 60 * 60 * 1000;
let lastUse = Services.appinfo.replacedLockTime;
- let disableResetPrompt = false;
- try {
- disableResetPrompt = Services.prefs.getBoolPref("browser.disableResetPrompt");
- } catch (e) {}
+ let disableResetPrompt = Services.prefs.getBoolPref("browser.disableResetPrompt", false);
if (!disableResetPrompt && lastUse &&
Date.now() - lastUse >= OFFER_PROFILE_RESET_INTERVAL_MS) {
@@ -1505,10 +1502,7 @@ BrowserGlue.prototype = {
} catch (ex) {}
// Support legacy bookmarks.html format for apps that depend on that format.
- let autoExportHTML = false;
- try {
- autoExportHTML = Services.prefs.getBoolPref("browser.bookmarks.autoExportHTML");
- } catch (ex) {} // Do not export.
+ let autoExportHTML = Services.prefs.getBoolPref("browser.bookmarks.autoExportHTML", false); // Do not export.
if (autoExportHTML) {
// Sqlite.jsm and Places shutdown happen at profile-before-change, thus,
// to be on the safe side, this should run earlier.
@@ -1578,10 +1572,7 @@ BrowserGlue.prototype = {
// An import operation is about to run.
// Don't try to recreate smart bookmarks if autoExportHTML is true or
// smart bookmarks are disabled.
- let smartBookmarksVersion = 0;
- try {
- smartBookmarksVersion = Services.prefs.getIntPref("browser.places.smartBookmarksVersion");
- } catch (ex) {}
+ let smartBookmarksVersion = Services.prefs.getIntPref("browser.places.smartBookmarksVersion", 0);
if (!autoExportHTML && smartBookmarksVersion != -1)
Services.prefs.setIntPref("browser.places.smartBookmarksVersion", 0);
@@ -1932,10 +1923,7 @@ BrowserGlue.prototype = {
// Refactor urlbar suggestion preferences to make it extendable and
// allow new suggestion types (e.g: search suggestions).
let types = ["history", "bookmark", "openpage"];
- let defaultBehavior = 0;
- try {
- defaultBehavior = Services.prefs.getIntPref("browser.urlbar.default.behavior");
- } catch (ex) {}
+ let defaultBehavior = Services.prefs.getIntPref("browser.urlbar.default.behavior", 0);
try {
let autocompleteEnabled = Services.prefs.getBoolPref("browser.urlbar.autocomplete.enabled");
if (!autocompleteEnabled) {
@@ -1988,12 +1976,8 @@ BrowserGlue.prototype = {
if (currentUIVersion < 30) {
// Convert old devedition theme pref to lightweight theme storage
- let lightweightThemeSelected = false;
- let selectedThemeID = null;
- try {
- lightweightThemeSelected = Services.prefs.prefHasUserValue("lightweightThemes.selectedThemeID");
- selectedThemeID = Services.prefs.getCharPref("lightweightThemes.selectedThemeID");
- } catch (e) {}
+ let lightweightThemeSelected = Services.prefs.prefHasUserValue("lightweightThemes.selectedThemeID", false);
+ let selectedThemeID = Services.prefs.getCharPref("lightweightThemes.selectedThemeID", "");
let defaultThemeSelected = false;
try {
@@ -2143,10 +2127,7 @@ BrowserGlue.prototype = {
const MAX_RESULTS = 10;
// Get current smart bookmarks version. If not set, create them.
- let smartBookmarksCurrentVersion = 0;
- try {
- smartBookmarksCurrentVersion = Services.prefs.getIntPref(SMART_BOOKMARKS_PREF);
- } catch (ex) {}
+ let smartBookmarksCurrentVersion = Services.prefs.getIntPref(SMART_BOOKMARKS_PREF, 0);
// If version is current, or smart bookmarks are disabled, bail out.
if (smartBookmarksCurrentVersion == -1 ||
diff --git a/application/basilisk/components/sync/aboutSyncTabs.js b/application/basilisk/components/sync/aboutSyncTabs.js
index 410494b5b..4808c052f 100644
--- a/application/basilisk/components/sync/aboutSyncTabs.js
+++ b/application/basilisk/components/sync/aboutSyncTabs.js
@@ -254,13 +254,7 @@ var RemoteTabViewer = {
_refetchTabs: function(force) {
if (!force) {
// Don't bother refetching tabs if we already did so recently
- let lastFetch = 0;
- try {
- lastFetch = Services.prefs.getIntPref("services.sync.lastTabFetch");
- }
- catch (e) {
- /* Just use the default value of 0 */
- }
+ lastFetch = Services.prefs.getIntPref("services.sync.lastTabFetch", 0);
let now = Math.floor(Date.now() / 1000);
if (now - lastFetch < 30) {
diff --git a/application/basilisk/modules/DirectoryLinksProvider.jsm b/application/basilisk/modules/DirectoryLinksProvider.jsm
index 117564099..85d8b296b 100644
--- a/application/basilisk/modules/DirectoryLinksProvider.jsm
+++ b/application/basilisk/modules/DirectoryLinksProvider.jsm
@@ -189,11 +189,7 @@ var DirectoryLinksProvider = {
* @return the selected locale or "en-US" if none is selected
*/
get locale() {
- let matchOS;
- try {
- matchOS = Services.prefs.getBoolPref(PREF_MATCH_OS_LOCALE);
- }
- catch (e) {}
+ let matchOS = Services.prefs.getBoolPref(PREF_MATCH_OS_LOCALE, false);
if (matchOS) {
return Services.locale.getLocaleComponentForUserAgent();
diff --git a/application/palemoon/base/content/browser-syncui.js b/application/palemoon/base/content/browser-syncui.js
index 67056e221..6fad03cdd 100644
--- a/application/palemoon/base/content/browser-syncui.js
+++ b/application/palemoon/base/content/browser-syncui.js
@@ -83,10 +83,7 @@ var gSyncUI = {
_wasDelayed: false,
_needsSetup: function SUI__needsSetup() {
- let firstSync = "";
- try {
- firstSync = Services.prefs.getCharPref("services.sync.firstSync");
- } catch (e) { }
+ let firstSync = Services.prefs.getCharPref("services.sync.firstSync", "");
return Weave.Status.checkSetup() == Weave.CLIENT_NOT_CONFIGURED ||
firstSync == "notReady";
},
@@ -285,11 +282,7 @@ var gSyncUI = {
if (!syncButton)
return;
- let lastSync;
- try {
- lastSync = Services.prefs.getCharPref("services.sync.lastSync");
- }
- catch (e) { };
+ let lastSync = Services.prefs.getCharPref("services.sync.lastSync");
if (!lastSync || this._needsSetup()) {
syncButton.removeAttribute("tooltiptext");
return;
diff --git a/application/palemoon/base/content/tabbrowser.xml b/application/palemoon/base/content/tabbrowser.xml
index 868179b5d..d9366f488 100644
--- a/application/palemoon/base/content/tabbrowser.xml
+++ b/application/palemoon/base/content/tabbrowser.xml
@@ -3628,11 +3628,7 @@
window.addEventListener("resize", this, false);
window.addEventListener("load", this, false);
- try {
- this._tabAnimationLoggingEnabled = Services.prefs.getBoolPref("browser.tabs.animationLogging.enabled");
- } catch (ex) {
- this._tabAnimationLoggingEnabled = false;
- }
+ this._tabAnimationLoggingEnabled = Services.prefs.getBoolPref("browser.tabs.animationLogging.enabled", false);
this._browserNewtabpageEnabled = Services.prefs.getBoolPref("browser.newtabpage.enabled");
]]>
</constructor>
diff --git a/application/palemoon/components/distribution.js b/application/palemoon/components/distribution.js
index d3300604e..121e55b1b 100644
--- a/application/palemoon/components/distribution.js
+++ b/application/palemoon/components/distribution.js
@@ -38,13 +38,7 @@ DistributionCustomizer.prototype = {
},
get _locale() {
- let locale;
- try {
- locale = this._prefs.getCharPref("general.useragent.locale");
- }
- catch (e) {
- locale = "en-US";
- }
+ let locale = this._prefs.getCharPref("general.useragent.locale", "en-US");
this.__defineGetter__("_locale", function() locale);
return this._locale;
},
@@ -221,11 +215,7 @@ DistributionCustomizer.prototype = {
this._ini.getString("Global", "id") + ".bookmarksProcessed";
}
- let bmProcessed = false;
- try {
- bmProcessed = this._prefs.getBoolPref(bmProcessedPref);
- }
- catch (e) {}
+ let bmProcessed = this._prefs.getBoolPref(bmProcessedPref, false);
if (!bmProcessed) {
if (sections["BookmarksMenu"])
diff --git a/application/palemoon/components/feeds/FeedWriter.js b/application/palemoon/components/feeds/FeedWriter.js
index d704835bb..facde5815 100644
--- a/application/palemoon/components/feeds/FeedWriter.js
+++ b/application/palemoon/components/feeds/FeedWriter.js
@@ -18,12 +18,7 @@ function LOG(str) {
var prefB = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch);
- var shouldLog = false;
- try {
- shouldLog = prefB.getBoolPref("feeds.log");
- }
- catch (ex) {
- }
+ var shouldLog = prefB.getBoolPref("feeds.log", false);
if (shouldLog)
dump("*** Feeds: " + str + "\n");
@@ -874,11 +869,7 @@ FeedWriter.prototype = {
Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch);
- var handler = "bookmarks";
- try {
- handler = prefs.getCharPref(getPrefReaderForType(feedType));
- }
- catch (ex) { }
+ var handler = prefs.getCharPref(getPrefReaderForType(feedType), "bookmarks");
switch (handler) {
case "web": {
@@ -1076,11 +1067,7 @@ FeedWriter.prototype = {
.addEventListener("command", this, false);
// first-run ui
- var showFirstRunUI = true;
- try {
- showFirstRunUI = prefs.getBoolPref(PREF_SHOW_FIRST_RUN_UI);
- }
- catch (ex) { }
+ var showFirstRunUI = prefs.getBoolPref(PREF_SHOW_FIRST_RUN_UI, true);
if (showFirstRunUI) {
var textfeedinfo1, textfeedinfo2;
switch (feedType) {
diff --git a/application/palemoon/components/feeds/WebContentConverter.js b/application/palemoon/components/feeds/WebContentConverter.js
index 41679b028..42e2edee0 100644
--- a/application/palemoon/components/feeds/WebContentConverter.js
+++ b/application/palemoon/components/feeds/WebContentConverter.js
@@ -436,13 +436,8 @@ WebContentConverterRegistrar.prototype = {
// check if it is in the black list
var pb = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
- var allowed;
- try {
- allowed = pb.getBoolPref(PREF_HANDLER_EXTERNAL_PREFIX + "." + aProtocol);
- }
- catch (e) {
- allowed = pb.getBoolPref(PREF_HANDLER_EXTERNAL_PREFIX + "-default");
- }
+ var allowed = pb.getBoolPref(PREF_HANDLER_EXTERNAL_PREFIX + "." + aProtocol,
+ pb.getBoolPref(PREF_HANDLER_EXTERNAL_PREFIX + "-default"));
if (!allowed) {
// XXX this should be a "security exception" according to spec
throw("Not allowed to register a protocol handler for " + aProtocol);
diff --git a/application/palemoon/components/nsBrowserContentHandler.js b/application/palemoon/components/nsBrowserContentHandler.js
index 6a75b40f2..e7f1414c2 100644
--- a/application/palemoon/components/nsBrowserContentHandler.js
+++ b/application/palemoon/components/nsBrowserContentHandler.js
@@ -100,20 +100,14 @@ const OVERRIDE_NEW_BUILD_ID = 3;
* OVERRIDE_NONE otherwise.
*/
function needHomepageOverride(prefb) {
- var savedmstone = null;
- try {
- savedmstone = prefb.getCharPref("browser.startup.homepage_override.mstone");
- } catch (e) {}
+ var savedmstone = prefb.getCharPref("browser.startup.homepage_override.mstone", "");
if (savedmstone == "ignore")
return OVERRIDE_NONE;
var mstone = Services.appinfo.platformVersion;
- var savedBuildID = null;
- try {
- savedBuildID = prefb.getCharPref("browser.startup.homepage_override.buildID");
- } catch (e) {}
+ var savedBuildID = prefb.getCharPref("browser.startup.homepage_override.buildID", "");
var buildID = Services.appinfo.platformBuildID;
@@ -550,10 +544,7 @@ nsBrowserContentHandler.prototype = {
// URL if we do end up showing an overridePage. This makes it possible
// to have the overridePage's content vary depending on the version we're
// upgrading from.
- let old_mstone = "unknown";
- try {
- old_mstone = Services.prefs.getCharPref("browser.startup.homepage_override.mstone");
- } catch (ex) {}
+ let old_mstone = Services.prefs.getCharPref("browser.startup.homepage_override.mstone", "unknown");
let override = needHomepageOverride(prefb);
if (override != OVERRIDE_NONE) {
switch (override) {
diff --git a/application/palemoon/components/nsBrowserGlue.js b/application/palemoon/components/nsBrowserGlue.js
index ad48dab29..01a133833 100644
--- a/application/palemoon/components/nsBrowserGlue.js
+++ b/application/palemoon/components/nsBrowserGlue.js
@@ -990,14 +990,8 @@ BrowserGlue.prototype = {
// An import operation is about to run.
// Don't try to recreate smart bookmarks if autoExportHTML is true or
// smart bookmarks are disabled.
- var autoExportHTML = false;
- try {
- autoExportHTML = Services.prefs.getBoolPref("browser.bookmarks.autoExportHTML");
- } catch(ex) {}
- var smartBookmarksVersion = 0;
- try {
- smartBookmarksVersion = Services.prefs.getIntPref("browser.places.smartBookmarksVersion");
- } catch(ex) {}
+ var autoExportHTML = Services.prefs.getBoolPref("browser.bookmarks.autoExportHTML", false);
+ var smartBookmarksVersion = Services.prefs.getIntPref("browser.places.smartBookmarksVersion", 0);
if (!autoExportHTML && smartBookmarksVersion != -1)
Services.prefs.setIntPref("browser.places.smartBookmarksVersion", 0);
@@ -1556,10 +1550,7 @@ BrowserGlue.prototype = {
const MAX_RESULTS = 10;
// Get current smart bookmarks version. If not set, create them.
- let smartBookmarksCurrentVersion = 0;
- try {
- smartBookmarksCurrentVersion = Services.prefs.getIntPref(SMART_BOOKMARKS_PREF);
- } catch(ex) {}
+ let smartBookmarksCurrentVersion = Services.prefs.getIntPref(SMART_BOOKMARKS_PREF, 0);
// If version is current or smart bookmarks are disabled, just bail out.
if (smartBookmarksCurrentVersion == -1 ||