diff options
Diffstat (limited to 'application')
15 files changed, 36 insertions, 151 deletions
diff --git a/application/basilisk/base/content/aboutaccounts/aboutaccounts.js b/application/basilisk/base/content/aboutaccounts/aboutaccounts.js index a05c1ea75..f03029b1d 100644 --- a/application/basilisk/base/content/aboutaccounts/aboutaccounts.js +++ b/application/basilisk/base/content/aboutaccounts/aboutaccounts.js @@ -450,14 +450,9 @@ function migrateToDevEdition(urlParams) { try { defaultProfilePath = window.getDefaultProfilePath(); } catch (e) {} // no default profile. - let migrateSyncCreds = false; - if (defaultProfilePath) { - try { - migrateSyncCreds = Services.prefs.getBoolPref("identity.fxaccounts.migrateToDevEdition"); - } catch (e) {} - } + let migrateSyncCreds = Services.prefs.getBoolPref("identity.fxaccounts.migrateToDevEdition", false); - if (!migrateSyncCreds) { + if (!defaultProfilePath || !migrateSyncCreds) { return Promise.resolve(false); } diff --git a/application/basilisk/base/content/browser-syncui.js b/application/basilisk/base/content/browser-syncui.js index 3a57140f2..7a80be87e 100644 --- a/application/basilisk/base/content/browser-syncui.js +++ b/application/basilisk/base/content/browser-syncui.js @@ -106,10 +106,7 @@ var gSyncUI = { }); } // We are using legacy sync - check that. - let firstSync = ""; - try { - firstSync = Services.prefs.getCharPref("services.sync.firstSync"); - } catch (e) { } + let firstSync = Services.prefs.getCharPref("services.sync.firstSync", ""); return Promise.resolve(Weave.Status.checkSetup() == Weave.CLIENT_NOT_CONFIGURED || firstSync == "notReady"); @@ -349,10 +346,7 @@ var gSyncUI = { */ maybeMoveSyncedTabsButton() { const prefName = "browser.migrated-sync-button"; - let migrated = false; - try { - migrated = Services.prefs.getBoolPref(prefName); - } catch (_) {} + let migrated = Services.prefs.getBoolPref(prefName, false); if (migrated) { return; } diff --git a/application/basilisk/base/content/browser.js b/application/basilisk/base/content/browser.js index ddbe11a9d..7e8f7d821 100644 --- a/application/basilisk/base/content/browser.js +++ b/application/basilisk/base/content/browser.js @@ -2579,15 +2579,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/sync/aboutSyncTabs.js b/application/basilisk/base/content/sync/aboutSyncTabs.js index f4bb607ea..69ec71e55 100644 --- a/application/basilisk/base/content/sync/aboutSyncTabs.js +++ b/application/basilisk/base/content/sync/aboutSyncTabs.js @@ -306,13 +306,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/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 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) { 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 d77e97f87..f2eb8fdf3 100644 --- a/application/basilisk/components/nsBrowserGlue.js +++ b/application/basilisk/components/nsBrowserGlue.js @@ -963,10 +963,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) { @@ -1507,10 +1504,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. @@ -1580,10 +1574,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); @@ -1934,10 +1925,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) { @@ -1990,12 +1978,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 { @@ -2145,10 +2129,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/preferences/in-content/sync.js b/application/basilisk/components/preferences/in-content/sync.js index 2600677a8..9496d34b6 100644 --- a/application/basilisk/components/preferences/in-content/sync.js +++ b/application/basilisk/components/preferences/in-content/sync.js @@ -86,21 +86,12 @@ var gSyncPane = { }, _showLoadPage: function (xps) { - let username; - try { - username = Services.prefs.getCharPref("services.sync.username"); - } catch (e) {} + let username = Services.prefs.getCharPref("services.sync.username", ""); if (!username) { this.page = FXA_PAGE_LOGGED_OUT; } else if (xps.fxAccountsEnabled) { // Use cached values while we wait for the up-to-date values - let cachedComputerName; - try { - cachedComputerName = Services.prefs.getCharPref("services.sync.client.name"); - } - catch (e) { - cachedComputerName = ""; - } + let cachedComputerName = Services.prefs.getCharPref("services.sync.client.name", ""); document.getElementById("fxaEmailAddress1").textContent = username; this._populateComputerName(cachedComputerName); this.page = FXA_PAGE_LOGGED_IN; 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(); |