mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-08 08:17:31 +09:00
Remove obsolete getPref helpers.
This commit is contained in:
parent
a85e8de713
commit
8d45fa6874
15 changed files with 103 additions and 307 deletions
|
|
@ -16,29 +16,9 @@ const PREF_APP_UPDATE_LOG = "app.update.log";
|
|||
const CATEGORY_UPDATE_TIMER = "update-timer";
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "gLogEnabled", function tm_gLogEnabled() {
|
||||
return getPref("getBoolPref", PREF_APP_UPDATE_LOG, false);
|
||||
return Services.prefs.getBoolPref(PREF_APP_UPDATE_LOG, false);
|
||||
});
|
||||
|
||||
/**
|
||||
* Gets a preference value, handling the case where there is no default.
|
||||
* @param func
|
||||
* The name of the preference function to call, on nsIPrefBranch
|
||||
* @param preference
|
||||
* The name of the preference
|
||||
* @param defaultValue
|
||||
* The default value to return in the event the preference has
|
||||
* no setting
|
||||
* @returns The value of the preference, or undefined if there was no
|
||||
* user or default value.
|
||||
*/
|
||||
function getPref(func, preference, defaultValue) {
|
||||
try {
|
||||
return Services.prefs[func](preference);
|
||||
} catch (e) {
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs a string to the error console.
|
||||
* @param string
|
||||
|
|
@ -93,13 +73,13 @@ TimerManager.prototype = {
|
|||
minInterval = 500;
|
||||
minFirstInterval = 500;
|
||||
case "profile-after-change":
|
||||
this._timerMinimumDelay = Math.max(1000 * getPref("getIntPref", PREF_APP_UPDATE_TIMERMINIMUMDELAY, 120),
|
||||
this._timerMinimumDelay = Math.max(1000 * Services.prefs.getIntPref(PREF_APP_UPDATE_TIMERMINIMUMDELAY, 120),
|
||||
minInterval);
|
||||
// Prevent the timer delay between notifications to other consumers from
|
||||
// being greater than 5 minutes which is 300000 milliseconds.
|
||||
this._timerMinimumDelay = Math.min(this._timerMinimumDelay, 300000);
|
||||
// Prevent the first interval from being less than the value of minFirstInterval
|
||||
let firstInterval = Math.max(getPref("getIntPref", PREF_APP_UPDATE_TIMERFIRSTINTERVAL,
|
||||
let firstInterval = Math.max(Services.prefs.getIntPref(PREF_APP_UPDATE_TIMERFIRSTINTERVAL,
|
||||
30000), minFirstInterval);
|
||||
// Prevent the first interval from being greater than 2 minutes which is
|
||||
// 120000 milliseconds.
|
||||
|
|
@ -189,7 +169,7 @@ TimerManager.prototype = {
|
|||
continue;
|
||||
}
|
||||
|
||||
let interval = getPref("getIntPref", prefInterval, defaultInterval);
|
||||
let interval = Services.prefs.getIntPref(prefInterval, defaultInterval);
|
||||
// Allow the update-timer category to specify a maximum value to prevent
|
||||
// values larger than desired.
|
||||
maxInterval = parseInt(maxInterval);
|
||||
|
|
@ -200,7 +180,7 @@ TimerManager.prototype = {
|
|||
timerID);
|
||||
// Initialize the last update time to 0 when the preference isn't set so
|
||||
// the timer will be notified soon after a new profile's first use.
|
||||
lastUpdateTime = getPref("getIntPref", prefLastUpdate, 0);
|
||||
lastUpdateTime = Services.prefs.getIntPref(prefLastUpdate, 0);
|
||||
|
||||
// If the last update time is greater than the current time then reset
|
||||
// it to 0 and the timer manager will correct the value when it fires
|
||||
|
|
@ -315,7 +295,7 @@ TimerManager.prototype = {
|
|||
let prefLastUpdate = PREF_APP_UPDATE_LASTUPDATETIME_FMT.replace(/%ID%/, id);
|
||||
// Initialize the last update time to 0 when the preference isn't set so
|
||||
// the timer will be notified soon after a new profile's first use.
|
||||
let lastUpdateTime = getPref("getIntPref", prefLastUpdate, 0);
|
||||
let lastUpdateTime = Services.prefs.getIntPref(prefLastUpdate, 0);
|
||||
let now = Math.round(Date.now() / 1000);
|
||||
if (lastUpdateTime > now) {
|
||||
lastUpdateTime = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue