mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
Bug 1344711 - hand cleanup of remaining useless try blocks around get*Pref calls identified by eslint, r=jaws.
--HG-- extra : rebase_source : 18c027010838faba91f0ac699f9bde07f85500e7
This commit is contained in:
parent
7f1b926f29
commit
37bbced84d
@ -60,6 +60,7 @@ function testObjectOutput(aAccOrElmOrID, aGenerator) {
|
||||
var context = new PivotContext(accessible);
|
||||
var output = aGenerator.genForObject(accessible, context);
|
||||
var outputOrder;
|
||||
// eslint-disable-next-line mozilla/use-default-preference-values
|
||||
try {
|
||||
outputOrder = SpecialPowers.getIntPref(PREF_UTTERANCE_ORDER);
|
||||
} catch (ex) {
|
||||
|
@ -46,6 +46,7 @@ var AdbController = {
|
||||
this.disableAdbTimer.cancel();
|
||||
} else {
|
||||
this.disableAdbTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
||||
// eslint-disable-next-line mozilla/use-default-preference-values
|
||||
try {
|
||||
this.disableAdbTimeoutHours =
|
||||
Services.prefs.getIntPref("b2g.adb.timeout-hours");
|
||||
|
@ -427,12 +427,8 @@ setUpdateTrackingId();
|
||||
return;
|
||||
}
|
||||
// Gaia setting has not been set; set the gaia setting to default.
|
||||
let prefValue = AppConstants.MOZ_TELEMETRY_ON_BY_DEFAULT;
|
||||
try {
|
||||
prefValue = Services.prefs.getBoolPref(geckoPrefName);
|
||||
} catch (e) {
|
||||
// Pref not set; use default value.
|
||||
}
|
||||
let prefValue = Services.prefs.getBoolPref(geckoPrefName,
|
||||
AppConstants.MOZ_TELEMETRY_ON_BY_DEFAULT);
|
||||
let setting = {};
|
||||
setting[gaiaSettingName] = prefValue;
|
||||
window.navigator.mozSettings.createLock().set(setting);
|
||||
|
@ -256,15 +256,11 @@ var shell = {
|
||||
// If --start-manifest hasn't been specified, we re-use the latest specified manifest.
|
||||
// If it's the first launch, we will fallback to b2g.default.start_manifest_url
|
||||
if (AppConstants.MOZ_GRAPHENE && !startManifestURL) {
|
||||
try {
|
||||
startManifestURL = Services.prefs.getCharPref("b2g.system_manifest_url");
|
||||
} catch(e) {}
|
||||
startManifestURL = Services.prefs.getCharPref("b2g.system_manifest_url", "");
|
||||
}
|
||||
|
||||
if (!startManifestURL) {
|
||||
try {
|
||||
startManifestURL = Services.prefs.getCharPref("b2g.default.start_manifest_url");
|
||||
} catch(e) {}
|
||||
startManifestURL = Services.prefs.getCharPref("b2g.default.start_manifest_url", "");
|
||||
}
|
||||
|
||||
if (startManifestURL) {
|
||||
|
@ -47,10 +47,7 @@ this.AboutServiceWorkers = {
|
||||
if (this._enabled) {
|
||||
return this._enabled;
|
||||
}
|
||||
this._enabled = false;
|
||||
try {
|
||||
this._enabled = Services.prefs.getBoolPref("dom.serviceWorkers.enabled");
|
||||
} catch(e) {}
|
||||
this._enabled = Services.prefs.getBoolPref("dom.serviceWorkers.enabled", false);
|
||||
return this._enabled;
|
||||
},
|
||||
|
||||
|
@ -75,6 +75,7 @@ this.Bootstraper = {
|
||||
return Promise.resolve();
|
||||
|
||||
let oldManifestURL;
|
||||
// eslint-disable-next-line mozilla/use-default-preference-values
|
||||
try{
|
||||
oldManifestURL = Services.prefs.getCharPref("b2g.system_manifest_url");
|
||||
} catch(e) {
|
||||
|
@ -94,12 +94,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "SystemAppProxy",
|
||||
// There's no point in setting up an observer to monitor the pref, as b2g prefs
|
||||
// can only be overwritten when the profie is recreated. So just get the value
|
||||
// on start-up.
|
||||
var kPersonaUri = "https://firefoxos.persona.org";
|
||||
try {
|
||||
kPersonaUri = Services.prefs.getCharPref("toolkit.identity.uri");
|
||||
} catch(noSuchPref) {
|
||||
// stick with the default value
|
||||
}
|
||||
var kPersonaUri = Services.prefs.getCharPref("toolkit.identity.uri",
|
||||
"https://firefoxos.persona.org");
|
||||
|
||||
// JS shim that contains the callback functions that
|
||||
// live within the identity UI provisioning frame.
|
||||
|
@ -432,14 +432,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) {}
|
||||
}
|
||||
|
||||
if (!migrateSyncCreds) {
|
||||
if (!defaultProfilePath ||
|
||||
!Services.prefs.getBoolPref("identity.fxaccounts.migrateToDevEdition", false)) {
|
||||
return Promise.resolve(false);
|
||||
}
|
||||
|
||||
|
@ -2793,9 +2793,7 @@ var gMenuButtonUpdateBadge = {
|
||||
cancelObserverRegistered: false,
|
||||
|
||||
init() {
|
||||
try {
|
||||
this.enabled = Services.prefs.getBoolPref("app.update.badge");
|
||||
} catch (e) {}
|
||||
this.enabled = Services.prefs.getBoolPref("app.update.badge", false);
|
||||
if (this.enabled) {
|
||||
this.badgeWaitTime = Services.prefs.getIntPref("app.update.badgeWaitTime",
|
||||
345600); // 4 days
|
||||
|
@ -42,9 +42,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",
|
||||
@ -624,11 +622,8 @@ CustomizeMode.prototype = {
|
||||
},
|
||||
|
||||
maybeShowTip(aAnchor) {
|
||||
let shown = false;
|
||||
const kShownPref = "browser.customizemode.tip0.shown";
|
||||
try {
|
||||
shown = Services.prefs.getBoolPref(kShownPref);
|
||||
} catch (ex) {}
|
||||
let shown = Services.prefs.getBoolPref(kShownPref, false);
|
||||
if (shown)
|
||||
return;
|
||||
|
||||
|
@ -1795,10 +1795,8 @@ this.UITour = {
|
||||
// Identifier of the partner repack, as stored in preference "distribution.id"
|
||||
// and included in Firefox and other update pings. Note this is not the same as
|
||||
// Services.appinfo.distributionID (value of MOZ_DISTRIBUTION_ID is set at build time).
|
||||
let distribution = "default";
|
||||
try {
|
||||
distribution = Services.prefs.getDefaultBranch("distribution.").getCharPref("id");
|
||||
} catch (e) {}
|
||||
let distribution =
|
||||
Services.prefs.getDefaultBranch("distribution.").getCharPref("id", "default");
|
||||
appinfo["distribution"] = distribution;
|
||||
|
||||
let isDefaultBrowser = null;
|
||||
|
@ -211,16 +211,11 @@ var ActiveProviders = {
|
||||
};
|
||||
|
||||
function migrateSettings() {
|
||||
let activeProviders, enabled;
|
||||
try {
|
||||
activeProviders = Services.prefs.getCharPref("social.activeProviders");
|
||||
} catch (e) {
|
||||
// not set, we'll check if we need to migrate older prefs
|
||||
}
|
||||
let enabled;
|
||||
if (Services.prefs.prefHasUserValue("social.enabled")) {
|
||||
enabled = Services.prefs.getBoolPref("social.enabled");
|
||||
}
|
||||
if (activeProviders) {
|
||||
if (Services.prefs.getCharPref("social.activeProviders", "")) {
|
||||
// migration from fx21 to fx22 or later
|
||||
// ensure any *builtin* provider in activeproviders is in user level prefs
|
||||
for (let origin in ActiveProviders._providers) {
|
||||
|
@ -21,19 +21,8 @@ var systemAppOrigin = (function () {
|
||||
return systemOrigin;
|
||||
})();
|
||||
|
||||
var threshold = 25;
|
||||
try {
|
||||
threshold = Services.prefs.getIntPref("ui.dragThresholdX");
|
||||
} catch (e) {
|
||||
// Fall back to default value
|
||||
}
|
||||
|
||||
var delay = 500;
|
||||
try {
|
||||
delay = Services.prefs.getIntPref("ui.click_hold_context_menus.delay");
|
||||
} catch (e) {
|
||||
// Fall back to default value
|
||||
}
|
||||
var threshold = Services.prefs.getIntPref("ui.dragThresholdX", 25);
|
||||
var delay = Services.prefs.getIntPref("ui.click_hold_context_menus.delay", 500);
|
||||
|
||||
function SimulatorCore(simulatorTarget) {
|
||||
this.simulatorTarget = simulatorTarget;
|
||||
|
@ -116,6 +116,7 @@ DirectoryProvider.prototype = {
|
||||
try {
|
||||
curLocale = Services.prefs.getComplexValue("general.useragent.locale", Ci.nsIPrefLocalizedString).data;
|
||||
} catch (e) {
|
||||
// eslint-disable-next-line mozilla/use-default-preference-values
|
||||
try {
|
||||
curLocale = Services.prefs.getCharPref("general.useragent.locale");
|
||||
} catch (ee) {
|
||||
|
@ -141,6 +141,7 @@ add_task(function*() {
|
||||
// If the pref isn't set and we're running on Linux on !isNightly(),
|
||||
// exit without failing. The Linux content sandbox is only enabled
|
||||
// on Nightly at this time.
|
||||
// eslint-disable-next-line mozilla/use-default-preference-values
|
||||
try {
|
||||
level = prefs.getIntPref("security.sandbox.content.level");
|
||||
} catch (e) {
|
||||
|
@ -134,6 +134,7 @@ add_task(function*() {
|
||||
// If the pref isn't set and we're running on Linux on !isNightly(),
|
||||
// exit without failing. The Linux content sandbox is only enabled
|
||||
// on Nightly at this time.
|
||||
// eslint-disable-next-line mozilla/use-default-preference-values
|
||||
try {
|
||||
level = prefs.getIntPref("security.sandbox.content.level");
|
||||
} catch (e) {
|
||||
|
@ -79,12 +79,8 @@ const DELAY_WARNING_MS = 10 * 1000;
|
||||
// Crash the process if shutdown is really too long
|
||||
// (allowing for sleep).
|
||||
const PREF_DELAY_CRASH_MS = "toolkit.asyncshutdown.crash_timeout";
|
||||
var DELAY_CRASH_MS = 60 * 1000; // One minute
|
||||
try {
|
||||
DELAY_CRASH_MS = Services.prefs.getIntPref(PREF_DELAY_CRASH_MS);
|
||||
} catch (ex) {
|
||||
// Ignore errors
|
||||
}
|
||||
var DELAY_CRASH_MS = Services.prefs.getIntPref(PREF_DELAY_CRASH_MS,
|
||||
60 * 1000); // One minute
|
||||
Services.prefs.addObserver(PREF_DELAY_CRASH_MS, function() {
|
||||
DELAY_CRASH_MS = Services.prefs.getIntPref(PREF_DELAY_CRASH_MS);
|
||||
}, false);
|
||||
@ -207,12 +203,7 @@ function log(msg, prefix = "", error = null) {
|
||||
}
|
||||
}
|
||||
const PREF_DEBUG_LOG = "toolkit.asyncshutdown.log";
|
||||
var DEBUG_LOG = false;
|
||||
try {
|
||||
DEBUG_LOG = Services.prefs.getBoolPref(PREF_DEBUG_LOG);
|
||||
} catch (ex) {
|
||||
// Ignore errors
|
||||
}
|
||||
var DEBUG_LOG = Services.prefs.getBoolPref(PREF_DEBUG_LOG, false);
|
||||
Services.prefs.addObserver(PREF_DEBUG_LOG, function() {
|
||||
DEBUG_LOG = Services.prefs.getBoolPref(PREF_DEBUG_LOG);
|
||||
}, false);
|
||||
|
@ -75,11 +75,8 @@ PlacesCategoriesStarter.prototype = {
|
||||
break;
|
||||
case "idle-daily":
|
||||
// Once a week run places.sqlite maintenance tasks.
|
||||
let lastMaintenance = 0;
|
||||
try {
|
||||
lastMaintenance =
|
||||
Services.prefs.getIntPref("places.database.lastMaintenance");
|
||||
} catch (ex) {}
|
||||
let lastMaintenance =
|
||||
Services.prefs.getIntPref("places.database.lastMaintenance", 0);
|
||||
let nowSeconds = parseInt(Date.now() / 1000);
|
||||
if (lastMaintenance < nowSeconds - MAINTENANCE_INTERVAL_SECONDS) {
|
||||
PlacesDBUtils.maintenanceOnIdle();
|
||||
|
@ -477,10 +477,7 @@ XPCOMUtils.defineLazyGetter(this, "Prefs", () => {
|
||||
store.maxCharsForSearchSuggestions = prefs.get(...PREF_MAX_CHARS_FOR_SUGGEST);
|
||||
store.prefillSitesEnabled = prefs.get(...PREF_PREFILL_SITES_ENABLED);
|
||||
store.prefillSitesExpireDays = prefs.get(...PREF_PREFILL_SITES_EXPIRE_DAYS);
|
||||
store.keywordEnabled = true;
|
||||
try {
|
||||
store.keywordEnabled = Services.prefs.getBoolPref("keyword.enabled");
|
||||
} catch (ex) {}
|
||||
store.keywordEnabled = Services.prefs.getBoolPref("keyword.enabled", true);
|
||||
|
||||
// If history is not set, onlyTyped value should be ignored.
|
||||
if (!store.suggestHistory) {
|
||||
|
@ -793,11 +793,8 @@ nsPlacesExpiration.prototype = {
|
||||
|
||||
_loadPrefs: Task.async(function* () {
|
||||
// Get the user's limit, if it was set.
|
||||
try {
|
||||
// We want to silently fail since getIntPref throws if it does not exist,
|
||||
// and use a default to fallback to.
|
||||
this._urisLimit = this._prefBranch.getIntPref(PREF_MAX_URIS);
|
||||
} catch (ex) { /* User limit not set */ }
|
||||
this._urisLimit = this._prefBranch.getIntPref(PREF_MAX_URIS,
|
||||
PREF_MAX_URIS_NOTSET);
|
||||
|
||||
if (this._urisLimit < 0) {
|
||||
// Some testing code expects a pref change to be synchronous, so
|
||||
@ -855,11 +852,8 @@ nsPlacesExpiration.prototype = {
|
||||
this._urisLimit);
|
||||
|
||||
// Get the expiration interval value.
|
||||
try {
|
||||
// We want to silently fail since getIntPref throws if it does not exist,
|
||||
// and use a default to fallback to.
|
||||
this._interval = this._prefBranch.getIntPref(PREF_INTERVAL_SECONDS);
|
||||
} catch (ex) { /* User interval not set */ }
|
||||
this._interval = this._prefBranch.getIntPref(PREF_INTERVAL_SECONDS,
|
||||
PREF_INTERVAL_SECONDS_NOTSET);
|
||||
if (this._interval <= 0) {
|
||||
this._interval = PREF_INTERVAL_SECONDS_NOTSET;
|
||||
}
|
||||
|
@ -56,14 +56,8 @@ var prefPrefix = "places.frecency.";
|
||||
function* task_initializeBucket(bucket) {
|
||||
let [cutoffName, weightName] = bucket;
|
||||
// get pref values
|
||||
var weight = 0, cutoff = 0;
|
||||
try {
|
||||
weight = prefs.getIntPref(prefPrefix + weightName);
|
||||
} catch (ex) {}
|
||||
try {
|
||||
cutoff = prefs.getIntPref(prefPrefix + cutoffName);
|
||||
} catch (ex) {}
|
||||
|
||||
var weight = prefs.getIntPref(prefPrefix + weightName, 0);
|
||||
var cutoff = prefs.getIntPref(prefPrefix + cutoffName, 0);
|
||||
if (cutoff < 1)
|
||||
return;
|
||||
|
||||
|
@ -27,11 +27,9 @@ function run_test() {
|
||||
QueryInterface(Ci.nsIXULRuntime);
|
||||
var abi = macutils && macutils.isUniversalBinary ? "Universal-gcc3" : appInfo.XPCOMABI;
|
||||
|
||||
let channel = "default";
|
||||
let defaults = prefs.QueryInterface(Ci.nsIPrefService).getDefaultBranch(null);
|
||||
try {
|
||||
channel = defaults.getCharPref("app.update.channel");
|
||||
} catch (e) {}
|
||||
let channel = defaults.getCharPref("app.update.channel", "default");
|
||||
|
||||
// Set distribution values.
|
||||
defaults.setCharPref("distribution.id", "bacon");
|
||||
defaults.setCharPref("distribution.version", "1.0");
|
||||
|
@ -724,6 +724,7 @@ function promiseTargetFile(aFpP, /* optional */ aSkipPrompt, /* optional */ aRel
|
||||
// The index of the selected filter is only preserved and restored if there's
|
||||
// more than one filter in addition to "All Files".
|
||||
if (aFpP.saveMode != SAVEMODE_FILEONLY) {
|
||||
// eslint-disable-next-line mozilla/use-default-preference-values
|
||||
try {
|
||||
fp.filterIndex = prefBranch.getIntPref("save_converter_index");
|
||||
} catch (e) {
|
||||
|
@ -824,11 +824,9 @@
|
||||
</content>
|
||||
<implementation implements="nsITimerCallback, nsIDOMEventListener">
|
||||
<constructor><![CDATA[
|
||||
try {
|
||||
this._scrollDelay = this._prefBranch
|
||||
.getIntPref("toolkit.scrollbox.clickToScroll.scrollDelay");
|
||||
} catch (ex) {
|
||||
}
|
||||
this._scrollDelay =
|
||||
this._prefBranch.getIntPref("toolkit.scrollbox.clickToScroll.scrollDelay",
|
||||
this._scrollDelay);
|
||||
]]></constructor>
|
||||
|
||||
<destructor><![CDATA[
|
||||
|
@ -194,6 +194,7 @@ var dataProviders = {
|
||||
if (AppConstants.MOZ_UPDATER)
|
||||
data.updateChannel = Cu.import("resource://gre/modules/UpdateUtils.jsm", {}).UpdateUtils.UpdateChannel;
|
||||
|
||||
// eslint-disable-next-line mozilla/use-default-preference-values
|
||||
try {
|
||||
data.vendor = Services.prefs.getCharPref("app.support.vendor");
|
||||
} catch (e) {}
|
||||
@ -527,6 +528,7 @@ var dataProviders = {
|
||||
data.isActive = Cc["@mozilla.org/xre/app-info;1"].
|
||||
getService(Ci.nsIXULRuntime).
|
||||
accessibilityEnabled;
|
||||
// eslint-disable-next-line mozilla/use-default-preference-values
|
||||
try {
|
||||
data.forceDisabled =
|
||||
Services.prefs.getIntPref("accessibility.force_disabled");
|
||||
|
@ -31,13 +31,9 @@ this.UpdateUtils = {
|
||||
* Whether or not to include the partner bits. Default: true.
|
||||
*/
|
||||
getUpdateChannel(aIncludePartners = true) {
|
||||
let channel = AppConstants.MOZ_UPDATE_CHANNEL;
|
||||
let defaults = Services.prefs.getDefaultBranch(null);
|
||||
try {
|
||||
channel = defaults.getCharPref("app.update.channel");
|
||||
} catch (e) {
|
||||
// use default value when pref not found
|
||||
}
|
||||
let channel = defaults.getCharPref("app.update.channel",
|
||||
AppConstants.MOZ_UPDATE_CHANNEL);
|
||||
|
||||
if (aIncludePartners) {
|
||||
try {
|
||||
|
@ -637,8 +637,8 @@ var gCheckUpdateSecurityDefault = true;
|
||||
var gCheckUpdateSecurity = gCheckUpdateSecurityDefault;
|
||||
var gUpdateEnabled = true;
|
||||
var gAutoUpdateDefault = true;
|
||||
var gHotfixID = null;
|
||||
var gWebExtensionsMinPlatformVersion = null;
|
||||
var gHotfixID = "";
|
||||
var gWebExtensionsMinPlatformVersion = "";
|
||||
var gShutdownBarrier = null;
|
||||
var gRepoShutdownState = "";
|
||||
var gShutdownInProgress = false;
|
||||
@ -835,44 +835,35 @@ var AddonManagerInternal = {
|
||||
Services.appinfo.version.replace(BRANCH_REGEXP, "$1");
|
||||
}
|
||||
|
||||
try {
|
||||
gCheckCompatibility = Services.prefs.getBoolPref(PREF_EM_CHECK_COMPATIBILITY);
|
||||
} catch (e) {}
|
||||
gCheckCompatibility = Services.prefs.getBoolPref(PREF_EM_CHECK_COMPATIBILITY,
|
||||
gCheckCompatibility);
|
||||
Services.prefs.addObserver(PREF_EM_CHECK_COMPATIBILITY, this, false);
|
||||
|
||||
try {
|
||||
gStrictCompatibility = Services.prefs.getBoolPref(PREF_EM_STRICT_COMPATIBILITY);
|
||||
} catch (e) {}
|
||||
gStrictCompatibility = Services.prefs.getBoolPref(PREF_EM_STRICT_COMPATIBILITY,
|
||||
gStrictCompatibility);
|
||||
Services.prefs.addObserver(PREF_EM_STRICT_COMPATIBILITY, this, false);
|
||||
|
||||
try {
|
||||
let defaultBranch = Services.prefs.getDefaultBranch("");
|
||||
gCheckUpdateSecurityDefault = defaultBranch.getBoolPref(PREF_EM_CHECK_UPDATE_SECURITY);
|
||||
} catch (e) {}
|
||||
let defaultBranch = Services.prefs.getDefaultBranch("");
|
||||
gCheckUpdateSecurityDefault = defaultBranch.getBoolPref(PREF_EM_CHECK_UPDATE_SECURITY,
|
||||
gCheckUpdateSecurityDefault);
|
||||
|
||||
try {
|
||||
gCheckUpdateSecurity = Services.prefs.getBoolPref(PREF_EM_CHECK_UPDATE_SECURITY);
|
||||
} catch (e) {}
|
||||
gCheckUpdateSecurity = Services.prefs.getBoolPref(PREF_EM_CHECK_UPDATE_SECURITY,
|
||||
gCheckUpdateSecurity);
|
||||
Services.prefs.addObserver(PREF_EM_CHECK_UPDATE_SECURITY, this, false);
|
||||
|
||||
try {
|
||||
gUpdateEnabled = Services.prefs.getBoolPref(PREF_EM_UPDATE_ENABLED);
|
||||
} catch (e) {}
|
||||
gUpdateEnabled = Services.prefs.getBoolPref(PREF_EM_UPDATE_ENABLED, gUpdateEnabled);
|
||||
Services.prefs.addObserver(PREF_EM_UPDATE_ENABLED, this, false);
|
||||
|
||||
try {
|
||||
gAutoUpdateDefault = Services.prefs.getBoolPref(PREF_EM_AUTOUPDATE_DEFAULT);
|
||||
} catch (e) {}
|
||||
gAutoUpdateDefault = Services.prefs.getBoolPref(PREF_EM_AUTOUPDATE_DEFAULT,
|
||||
gAutoUpdateDefault);
|
||||
Services.prefs.addObserver(PREF_EM_AUTOUPDATE_DEFAULT, this, false);
|
||||
|
||||
try {
|
||||
gHotfixID = Services.prefs.getCharPref(PREF_EM_HOTFIX_ID);
|
||||
} catch (e) {}
|
||||
gHotfixID = Services.prefs.getCharPref(PREF_EM_HOTFIX_ID, gHotfixID);
|
||||
Services.prefs.addObserver(PREF_EM_HOTFIX_ID, this, false);
|
||||
|
||||
try {
|
||||
gWebExtensionsMinPlatformVersion = Services.prefs.getCharPref(PREF_MIN_WEBEXT_PLATFORM_VERSION);
|
||||
} catch (e) {}
|
||||
gWebExtensionsMinPlatformVersion =
|
||||
Services.prefs.getCharPref(PREF_MIN_WEBEXT_PLATFORM_VERSION,
|
||||
gWebExtensionsMinPlatformVersion);
|
||||
Services.prefs.addObserver(PREF_MIN_WEBEXT_PLATFORM_VERSION, this, false);
|
||||
|
||||
let defaultProvidersEnabled = Services.prefs.getBoolPref(PREF_DEFAULT_PROVIDERS_ENABLED, true);
|
||||
|
@ -799,11 +799,8 @@ var _previewTimerCallback = {
|
||||
function _prefObserver(aSubject, aTopic, aData) {
|
||||
switch (aData) {
|
||||
case "maxUsedThemes":
|
||||
try {
|
||||
_maxUsedThemes = _prefs.getIntPref(aData);
|
||||
} catch (e) {
|
||||
_maxUsedThemes = DEFAULT_MAX_USED_THEMES_COUNT;
|
||||
}
|
||||
_maxUsedThemes = _prefs.getIntPref(aData, DEFAULT_MAX_USED_THEMES_COUNT);
|
||||
|
||||
// Update the theme list to remove any themes over the number we keep
|
||||
_updateUsedThemes(LightweightThemeManager.usedThemes);
|
||||
break;
|
||||
|
@ -1887,6 +1887,7 @@ var gCategories = {
|
||||
|
||||
AddonManager.addTypeListener(this);
|
||||
|
||||
// eslint-disable-next-line mozilla/use-default-preference-values
|
||||
try {
|
||||
this.node.value = Services.prefs.getCharPref(PREF_UI_LASTCATEGORY);
|
||||
} catch (e) { }
|
||||
|
@ -254,16 +254,7 @@ function getLocale() {
|
||||
|
||||
/* Get the distribution pref values, from defaults only */
|
||||
function getDistributionPrefValue(aPrefName) {
|
||||
var prefValue = "default";
|
||||
|
||||
var defaults = gPref.getDefaultBranch(null);
|
||||
try {
|
||||
prefValue = defaults.getCharPref(aPrefName);
|
||||
} catch (e) {
|
||||
// use default when pref not found
|
||||
}
|
||||
|
||||
return prefValue;
|
||||
return gPref.getDefaultBranch(null).getCharPref(aPrefName, "default");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -211,7 +211,7 @@ function run_test() {
|
||||
hotfixID = 99;
|
||||
Services.prefs.deleteBranch("extensions.hotfix.id");
|
||||
Services.prefs.setIntPref("extensions.hotfix.id", hotfixID);
|
||||
do_check_eq(AddonManager.hotfixID, null);
|
||||
do_check_eq(AddonManager.hotfixID, "");
|
||||
Services.prefs.clearUserPref("extensions.hotfix.id");
|
||||
|
||||
// After removing the listener, ensure we get no further events.
|
||||
|
Loading…
Reference in New Issue
Block a user