mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 19:35:51 +00:00
Bug 1344711 - hand cleanup of cases that were ignored by the script to remove try blocks around get*Pref calls, r=jaws.
--HG-- extra : rebase_source : 4da1e10b87ac37de19e0ca6f79996e8a12492db9
This commit is contained in:
parent
cd762cc83c
commit
7f1b926f29
@ -1923,16 +1923,10 @@ var CustomizableUIInternal = {
|
||||
// state immediately when a browser window opens, which is important for
|
||||
// other consumers of this API.
|
||||
loadSavedState() {
|
||||
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 {
|
||||
|
@ -183,12 +183,9 @@ 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}`,
|
||||
|
@ -12,15 +12,10 @@ const PREF_BRANCH = BASE_PREF + ".";
|
||||
|
||||
// Utilities:
|
||||
function getMaxContentParents(processType) {
|
||||
let maxContentParents = -1;
|
||||
try {
|
||||
maxContentParents = Services.prefs.getIntPref(PREF_BRANCH + processType);
|
||||
} catch (e) {
|
||||
// Pref probably didn't exist, get the default number of processes.
|
||||
maxContentParents = Services.prefs.getIntPref(BASE_PREF, 1);
|
||||
}
|
||||
|
||||
return maxContentParents;
|
||||
// If the pref doesn't exist, get the default number of processes.
|
||||
// If there's no pref, use only one process.
|
||||
return Services.prefs.getIntPref(PREF_BRANCH + processType,
|
||||
Services.prefs.getIntPref(BASE_PREF, 1));
|
||||
}
|
||||
|
||||
// Fills up aProcesses until max and then selects randomly from the available
|
||||
|
@ -14,13 +14,7 @@ const Ci = Components.interfaces;
|
||||
const CONTENT_PAGE = "http://mochi.test:8888/chrome/dom/tests/mochitest/localstorage/page_blank.html";
|
||||
const slavePath = "/chrome/dom/tests/mochitest/localstorage/";
|
||||
var currentTest = 1;
|
||||
var quota;
|
||||
|
||||
try {
|
||||
quota = Services.prefs.getIntPref("dom.storage.default_quota");
|
||||
} catch (ex) {
|
||||
quota = 5 * 1024;
|
||||
}
|
||||
var quota = Services.prefs.getIntPref("dom.storage.default_quota", 5 * 1024);
|
||||
Services.prefs.setIntPref("browser.startup.page", 0);
|
||||
Services.prefs.setIntPref("dom.storage.default_quota", 1);
|
||||
|
||||
|
@ -619,14 +619,7 @@ this.FxAccountsManager = {
|
||||
},
|
||||
|
||||
getKeys() {
|
||||
let syncEnabled = false;
|
||||
try {
|
||||
syncEnabled = Services.prefs.getBoolPref("services.sync.enabled");
|
||||
} catch (e) {
|
||||
dump("Sync is disabled, so you won't get the keys. " + e + "\n");
|
||||
}
|
||||
|
||||
if (!syncEnabled) {
|
||||
if (!Services.prefs.getBoolPref("services.sync.enabled", false)) {
|
||||
return Promise.reject(ERROR_SYNC_DISABLED);
|
||||
}
|
||||
|
||||
|
@ -240,10 +240,9 @@ var Scheduler = this.Scheduler = {
|
||||
* Prepare to kill the OS.File worker after a few seconds.
|
||||
*/
|
||||
restartTimer: function(arg) {
|
||||
let delay;
|
||||
try {
|
||||
delay = Services.prefs.getIntPref("osfile.reset_worker_delay");
|
||||
} catch(e) {
|
||||
let delay = Services.prefs.getIntPref("osfile.reset_worker_delay", 0);
|
||||
|
||||
if (!delay) {
|
||||
// Don't auto-shutdown if we don't have a delay preference set.
|
||||
return;
|
||||
}
|
||||
|
@ -996,17 +996,15 @@ function QueryParameter(aName, aValue, aPurpose) {
|
||||
function ParamSubstitution(aParamValue, aSearchTerms, aEngine) {
|
||||
var value = aParamValue;
|
||||
|
||||
var distributionID = Services.appinfo.distributionID;
|
||||
try {
|
||||
distributionID = Services.prefs.getCharPref(BROWSER_SEARCH_PREF + "distributionID");
|
||||
} catch (ex) { }
|
||||
var official = MOZ_OFFICIAL;
|
||||
try {
|
||||
if (Services.prefs.getBoolPref(BROWSER_SEARCH_PREF + "official"))
|
||||
official = "official";
|
||||
else
|
||||
official = "unofficial";
|
||||
} catch (ex) { }
|
||||
var distributionID =
|
||||
Services.prefs.getCharPref(BROWSER_SEARCH_PREF + "distributionID",
|
||||
Services.appinfo.distributionID || "");
|
||||
|
||||
var official;
|
||||
if (Services.prefs.getBoolPref(BROWSER_SEARCH_PREF + "official", MOZ_OFFICIAL))
|
||||
official = "official";
|
||||
else
|
||||
official = "unofficial";
|
||||
|
||||
// Custom search parameters. These are only available to default search
|
||||
// engines.
|
||||
|
@ -12,12 +12,7 @@ Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
// Log only if browser.safebrowsing.debug is true
|
||||
function log(...stuff) {
|
||||
let logging = null;
|
||||
try {
|
||||
logging = Services.prefs.getBoolPref("browser.safebrowsing.debug");
|
||||
} catch(e) {
|
||||
return;
|
||||
}
|
||||
let logging = Services.prefs.getBoolPref("browser.safebrowsing.debug", false);
|
||||
if (!logging) {
|
||||
return;
|
||||
}
|
||||
@ -29,18 +24,14 @@ function log(...stuff) {
|
||||
|
||||
function getLists(prefName) {
|
||||
log("getLists: " + prefName);
|
||||
let pref = null;
|
||||
try {
|
||||
pref = Services.prefs.getCharPref(prefName);
|
||||
} catch(e) {
|
||||
return null;
|
||||
}
|
||||
let pref = Services.prefs.getCharPref(prefName, "");
|
||||
|
||||
// Splitting an empty string returns [''], we really want an empty array.
|
||||
if (!pref) {
|
||||
return [];
|
||||
}
|
||||
return pref.split(",")
|
||||
.map(function(value) { return value.trim(); });
|
||||
|
||||
return pref.split(",").map(value => value.trim());
|
||||
}
|
||||
|
||||
const tablePreferences = [
|
||||
|
@ -30,12 +30,7 @@ XPCOMUtils.defineLazyServiceGetter(this, 'gUrlUtil',
|
||||
|
||||
// Log only if browser.safebrowsing.debug is true
|
||||
function log(...stuff) {
|
||||
let logging = null;
|
||||
try {
|
||||
logging = Services.prefs.getBoolPref("browser.safebrowsing.debug");
|
||||
} catch(e) {
|
||||
return;
|
||||
}
|
||||
let logging = Services.prefs.getBoolPref("browser.safebrowsing.debug", false);
|
||||
if (!logging) {
|
||||
return;
|
||||
}
|
||||
|
@ -880,11 +880,8 @@
|
||||
<![CDATA[
|
||||
var psvc = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
var animate = /Mac/.test(navigator.platform);
|
||||
try {
|
||||
animate = psvc.getBoolPref("browser.preferences.animateFadeIn");
|
||||
} catch (e) { }
|
||||
return animate;
|
||||
return psvc.getBoolPref("browser.preferences.animateFadeIn",
|
||||
/Mac/.test(navigator.platform));
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
|
@ -469,14 +469,7 @@ this.AddonRepository = {
|
||||
*/
|
||||
get cacheEnabled() {
|
||||
let preference = PREF_GETADDONS_CACHE_ENABLED;
|
||||
let enabled = false;
|
||||
try {
|
||||
enabled = Services.prefs.getBoolPref(preference);
|
||||
} catch (e) {
|
||||
logger.warn("cacheEnabled: Couldn't get pref: " + preference);
|
||||
}
|
||||
|
||||
return enabled;
|
||||
return Services.prefs.getBoolPref(preference, false);
|
||||
},
|
||||
|
||||
// A cache of the add-ons stored in the database
|
||||
@ -1486,10 +1479,8 @@ this.AddonRepository = {
|
||||
|
||||
// Create url from preference, returning null if preference does not exist
|
||||
_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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user