mirror of
https://github.com/roytam1/basilisk55.git
synced 2026-05-26 15:02:46 +00:00
ported from UXP: Remove obsolete getPref helpers. (8d45fa68)
This commit is contained in:
@@ -1339,7 +1339,7 @@ var gBrowserInit = {
|
||||
|
||||
// Setup click-and-hold gestures access to the session history
|
||||
// menus if global click-and-hold isn't turned on
|
||||
if (!getBoolPref("ui.click_hold_context_menus", false))
|
||||
if (!Services.prefs.getBoolPref("ui.click_hold_context_menus", false))
|
||||
SetClickAndHoldHandlers();
|
||||
|
||||
let NP = {};
|
||||
@@ -1938,7 +1938,7 @@ function BrowserGoHome(aEvent) {
|
||||
case "tabshifted":
|
||||
case "tab":
|
||||
urls = homePage.split("|");
|
||||
var loadInBackground = getBoolPref("browser.tabs.loadBookmarksInBackground", false);
|
||||
var loadInBackground = Services.prefs.getBoolPref("browser.tabs.loadBookmarksInBackground", false);
|
||||
gBrowser.loadTabs(urls, loadInBackground);
|
||||
break;
|
||||
case "window":
|
||||
|
||||
@@ -59,14 +59,6 @@ function openTopWin(url) {
|
||||
openUILinkIn(url, "current");
|
||||
}
|
||||
|
||||
function getBoolPref(prefname, def) {
|
||||
try {
|
||||
return Services.prefs.getBoolPref(prefname);
|
||||
} catch (er) {
|
||||
return def;
|
||||
}
|
||||
}
|
||||
|
||||
/* openUILink handles clicks on UI elements that cause URLs to load.
|
||||
*
|
||||
* As the third argument, you may pass an object with the same properties as
|
||||
@@ -132,7 +124,7 @@ function whereToOpenLink(e, ignoreButton, ignoreAlt) {
|
||||
|
||||
// ignoreButton allows "middle-click paste" to use function without always opening in a new window.
|
||||
var middle = !ignoreButton && e.button == 1;
|
||||
var middleUsesTabs = getBoolPref("browser.tabs.opentabfor.middleclick", true);
|
||||
var middleUsesTabs = Services.prefs.getBoolPref("browser.tabs.opentabfor.middleclick", true);
|
||||
|
||||
// Don't do anything special with right-mouse clicks. They're probably clicks on context menu items.
|
||||
|
||||
@@ -145,7 +137,7 @@ function whereToOpenLink(e, ignoreButton, ignoreAlt) {
|
||||
if (metaKey || (middle && middleUsesTabs))
|
||||
return shift ? "tabshifted" : "tab";
|
||||
|
||||
if (alt && getBoolPref("browser.altClickSave", false))
|
||||
if (alt && Services.prefs.getBoolPref("browser.altClickSave", false))
|
||||
return "save";
|
||||
|
||||
if (shift || (middle && !middleUsesTabs))
|
||||
@@ -370,7 +362,7 @@ function openLinkIn(url, where, params) {
|
||||
loadInBackground = aInBackground;
|
||||
if (loadInBackground == null) {
|
||||
loadInBackground =
|
||||
aFromChrome ? false : getBoolPref("browser.tabs.loadInBackground");
|
||||
aFromChrome ? false : Services.prefs.getBoolPref("browser.tabs.loadInBackground");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -653,7 +645,7 @@ function getShellService() {
|
||||
|
||||
function isBidiEnabled() {
|
||||
// first check the pref.
|
||||
if (getBoolPref("bidi.browser.ui", false))
|
||||
if (Services.prefs.getBoolPref("bidi.browser.ui", false))
|
||||
return true;
|
||||
|
||||
// then check intl.uidirection.<locale>
|
||||
@@ -913,7 +905,7 @@ function openHelpLink(aHelpTopic, aCalledFromModal, aWhere) {
|
||||
function openPrefsHelp() {
|
||||
// non-instant apply prefwindows are usually modal, so we can't open in the topmost window,
|
||||
// since its probably behind the window.
|
||||
var instantApply = getBoolPref("browser.preferences.instantApply");
|
||||
var instantApply = Services.prefs.getBoolPref("browser.preferences.instantApply");
|
||||
|
||||
var helpTopic = document.getElementsByTagName("prefwindow")[0].currentPane.helpTopic;
|
||||
openHelpLink(helpTopic, !instantApply);
|
||||
|
||||
@@ -51,23 +51,6 @@ XPCOMUtils.defineLazyModuleGetter(this, 'PdfjsChromeUtils',
|
||||
'resource://pdf.js/PdfjsChromeUtils.jsm');
|
||||
XPCOMUtils.defineLazyModuleGetter(this, 'PdfjsContentUtils',
|
||||
'resource://pdf.js/PdfjsContentUtils.jsm');
|
||||
|
||||
function getBoolPref(aPref, aDefaultValue) {
|
||||
try {
|
||||
return Services.prefs.getBoolPref(aPref);
|
||||
} catch (ex) {
|
||||
return aDefaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
function getIntPref(aPref, aDefaultValue) {
|
||||
try {
|
||||
return Services.prefs.getIntPref(aPref);
|
||||
} catch (ex) {
|
||||
return aDefaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
function isDefaultHandler() {
|
||||
if (Services.appinfo.processType === Services.appinfo.PROCESS_TYPE_CONTENT) {
|
||||
return PdfjsContentUtils.isDefaultHandlerApp();
|
||||
@@ -172,7 +155,7 @@ var PdfJs = {
|
||||
}
|
||||
this._initialized = true;
|
||||
|
||||
if (!getBoolPref(PREF_DISABLED, true)) {
|
||||
if (!Services.prefs.getBoolPref(PREF_DISABLED, true)) {
|
||||
this._migrate();
|
||||
}
|
||||
|
||||
@@ -209,7 +192,7 @@ var PdfJs = {
|
||||
|
||||
_migrate: function migrate() {
|
||||
const VERSION = 2;
|
||||
var currentVersion = getIntPref(PREF_MIGRATION_VERSION, 0);
|
||||
var currentVersion = Services.prefs.getIntPref(PREF_MIGRATION_VERSION, 0);
|
||||
if (currentVersion >= VERSION) {
|
||||
return;
|
||||
}
|
||||
@@ -284,7 +267,7 @@ var PdfJs = {
|
||||
* @return {boolean} Whether or not it's enabled.
|
||||
*/
|
||||
get enabled() {
|
||||
var disabled = getBoolPref(PREF_DISABLED, true);
|
||||
var disabled = Services.prefs.getBoolPref(PREF_DISABLED, true);
|
||||
if (disabled) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -77,22 +77,6 @@ function getFindBar(domWindow) {
|
||||
}
|
||||
}
|
||||
|
||||
function getBoolPref(pref, def) {
|
||||
try {
|
||||
return Services.prefs.getBoolPref(pref);
|
||||
} catch (ex) {
|
||||
return def;
|
||||
}
|
||||
}
|
||||
|
||||
function getIntPref(pref, def) {
|
||||
try {
|
||||
return Services.prefs.getIntPref(pref);
|
||||
} catch (ex) {
|
||||
return def;
|
||||
}
|
||||
}
|
||||
|
||||
function getStringPref(pref, def) {
|
||||
try {
|
||||
return Services.prefs.getComplexValue(pref, Ci.nsISupportsString).data;
|
||||
@@ -102,7 +86,7 @@ function getStringPref(pref, def) {
|
||||
}
|
||||
|
||||
function log(aMsg) {
|
||||
if (!getBoolPref(PREF_PREFIX + '.pdfBugEnabled', false)) {
|
||||
if (!Services.prefs.getBoolPref(PREF_PREFIX + '.pdfBugEnabled', false)) {
|
||||
return;
|
||||
}
|
||||
var msg = 'PdfStreamConverter.js: ' + (aMsg.join ? aMsg.join('') : aMsg);
|
||||
@@ -346,17 +330,17 @@ ChromeActions.prototype = {
|
||||
return !!findBar && ('updateControlState' in findBar);
|
||||
},
|
||||
supportsDocumentFonts: function() {
|
||||
var prefBrowser = getIntPref('browser.display.use_document_fonts', 1);
|
||||
var prefGfx = getBoolPref('gfx.downloadable_fonts.enabled', true);
|
||||
var prefBrowser = Services.prefs.getIntPref('browser.display.use_document_fonts', 1);
|
||||
var prefGfx = Services.prefs.getBoolPref('gfx.downloadable_fonts.enabled', true);
|
||||
return (!!prefBrowser && prefGfx);
|
||||
},
|
||||
supportsDocumentColors: function() {
|
||||
return getIntPref('browser.display.document_color_use', 0) !== 2;
|
||||
return Services.prefs.getIntPref('browser.display.document_color_use', 0) !== 2;
|
||||
},
|
||||
supportedMouseWheelZoomModifierKeys: function() {
|
||||
return {
|
||||
ctrlKey: getIntPref('mousewheel.with_control.action', 3) === 3,
|
||||
metaKey: getIntPref('mousewheel.with_meta.action', 1) === 3,
|
||||
ctrlKey: Services.prefs.getIntPref('mousewheel.with_control.action', 3) === 3,
|
||||
metaKey: Services.prefs.getIntPref('mousewheel.with_meta.action', 1) === 3,
|
||||
};
|
||||
},
|
||||
reportTelemetry: function (data) {
|
||||
@@ -518,10 +502,10 @@ ChromeActions.prototype = {
|
||||
prefName = (PREF_PREFIX + '.' + key);
|
||||
switch (typeof prefValue) {
|
||||
case 'boolean':
|
||||
currentPrefs[key] = getBoolPref(prefName, prefValue);
|
||||
currentPrefs[key] = Services.prefs.getBoolPref(prefName, prefValue);
|
||||
break;
|
||||
case 'number':
|
||||
currentPrefs[key] = getIntPref(prefName, prefValue);
|
||||
currentPrefs[key] = Services.prefs.getIntPref(prefName, prefValue);
|
||||
break;
|
||||
case 'string':
|
||||
currentPrefs[key] = getStringPref(prefName, prefValue);
|
||||
@@ -908,16 +892,16 @@ PdfStreamConverter.prototype = {
|
||||
} catch (e) {}
|
||||
|
||||
var hash = aRequest.URI.ref;
|
||||
var isPDFBugEnabled = getBoolPref(PREF_PREFIX + '.pdfBugEnabled', false);
|
||||
var isPDFBugEnabled = Services.prefs.getBoolPref(PREF_PREFIX + '.pdfBugEnabled', false);
|
||||
rangeRequest = contentEncoding === 'identity' &&
|
||||
acceptRanges === 'bytes' &&
|
||||
aRequest.contentLength >= 0 &&
|
||||
!getBoolPref(PREF_PREFIX + '.disableRange', false) &&
|
||||
!Services.prefs.getBoolPref(PREF_PREFIX + '.disableRange', false) &&
|
||||
(!isPDFBugEnabled ||
|
||||
hash.toLowerCase().indexOf('disablerange=true') < 0);
|
||||
streamRequest = contentEncoding === 'identity' &&
|
||||
aRequest.contentLength >= 0 &&
|
||||
!getBoolPref(PREF_PREFIX + '.disableStream', false) &&
|
||||
!Services.prefs.getBoolPref(PREF_PREFIX + '.disableStream', false) &&
|
||||
(!isPDFBugEnabled ||
|
||||
hash.toLowerCase().indexOf('disablestream=true') < 0);
|
||||
}
|
||||
|
||||
@@ -23,15 +23,6 @@ function debug(msg) {
|
||||
//dump("BrowserElementParent - " + msg + "\n");
|
||||
}
|
||||
|
||||
function getIntPref(prefName, def) {
|
||||
try {
|
||||
return Services.prefs.getIntPref(prefName);
|
||||
}
|
||||
catch(err) {
|
||||
return def;
|
||||
}
|
||||
}
|
||||
|
||||
function handleWindowEvent(e) {
|
||||
if (this._browserElementParents) {
|
||||
let beps = ThreadSafeChromeUtils.nondeterministicGetWeakMapKeys(this._browserElementParents);
|
||||
@@ -679,8 +670,8 @@ BrowserElementParent.prototype = {
|
||||
*/
|
||||
zoom: defineNoReturnMethod(function(zoom) {
|
||||
zoom *= 100;
|
||||
zoom = Math.min(getIntPref("zoom.maxPercent", 300), zoom);
|
||||
zoom = Math.max(getIntPref("zoom.minPercent", 50), zoom);
|
||||
zoom = Math.min(Services.prefs.getIntPref("zoom.maxPercent", 300), zoom);
|
||||
zoom = Math.max(Services.prefs.getIntPref("zoom.minPercent", 50), zoom);
|
||||
this._sendAsyncMsg('zoom', {zoom: zoom / 100.0});
|
||||
}),
|
||||
|
||||
|
||||
@@ -23,14 +23,6 @@ XPCOMUtils.defineLazyModuleGetter(this, "EventDispatcher",
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "OS", "resource://gre/modules/osfile.jsm");
|
||||
|
||||
function getPref(func, preference, defaultValue) {
|
||||
try {
|
||||
return Services.prefs[func](preference);
|
||||
}
|
||||
catch (e) {}
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Add-on auto-update management service
|
||||
// -----------------------------------------------------------------------
|
||||
@@ -49,7 +41,7 @@ AddonUpdateService.prototype = {
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsITimerCallback]),
|
||||
|
||||
notify: function aus_notify(aTimer) {
|
||||
if (aTimer && !getPref("getBoolPref", PREF_ADDON_UPDATE_ENABLED, true))
|
||||
if (aTimer && !Services.prefs.getBoolPref(PREF_ADDON_UPDATE_ENABLED, true))
|
||||
return;
|
||||
|
||||
// If we already auto-upgraded and installed new versions, ignore this check
|
||||
@@ -61,7 +53,7 @@ AddonUpdateService.prototype = {
|
||||
let gmp = new GMPInstallManager();
|
||||
gmp.simpleCheckAndInstall().then(null, () => {});
|
||||
|
||||
let interval = 1000 * getPref("getIntPref", PREF_ADDON_UPDATE_INTERVAL, 86400);
|
||||
let interval = 1000 * Services.prefs.getIntPref(PREF_ADDON_UPDATE_INTERVAL, 86400);
|
||||
EventDispatcher.instance.sendRequest({
|
||||
type: "Gecko:ScheduleRun",
|
||||
action: "update-addons",
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -84,27 +84,6 @@ function openUpdateURL(event) {
|
||||
openURL(event.target.getAttribute("url"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
LOG("General", "getPref - failed to get preference: " + preference);
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* A set of shared data and control functions for the wizard as a whole.
|
||||
*/
|
||||
@@ -319,7 +298,7 @@ var gUpdates = {
|
||||
onLoad() {
|
||||
this.wiz = document.documentElement;
|
||||
|
||||
gLogEnabled = getPref("getBoolPref", PREF_APP_UPDATE_LOG, false);
|
||||
gLogEnabled = Services.prefs.getBoolPref(PREF_APP_UPDATE_LOG, false);
|
||||
|
||||
this.strings = document.getElementById("updateStrings");
|
||||
var brandStrings = document.getElementById("brandStrings");
|
||||
@@ -599,7 +578,7 @@ var gNoUpdatesPage = {
|
||||
LOG("gNoUpdatesPage", "onPageShow - could not select an appropriate " +
|
||||
"update. Either there were no updates or |selectUpdate| failed");
|
||||
|
||||
if (getPref("getBoolPref", PREF_APP_UPDATE_ENABLED, true))
|
||||
if (Services.prefs.getBoolPref(PREF_APP_UPDATE_ENABLED, true))
|
||||
document.getElementById("noUpdatesAutoEnabled").hidden = false;
|
||||
else
|
||||
document.getElementById("noUpdatesAutoDisabled").hidden = false;
|
||||
@@ -1277,7 +1256,7 @@ var gFinishedPage = {
|
||||
moreElevatedLinkLabel.setAttribute("hidden", "false");
|
||||
}
|
||||
|
||||
if (getPref("getBoolPref", PREF_APP_UPDATE_TEST_LOOP, false)) {
|
||||
if (Services.prefs.getBoolPref(PREF_APP_UPDATE_TEST_LOOP, false)) {
|
||||
setTimeout(function() { gUpdates.wiz.getButton("finish").click(); },
|
||||
UPDATE_TEST_LOOP_INTERVAL);
|
||||
}
|
||||
|
||||
@@ -213,7 +213,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "UpdateUtils",
|
||||
"resource://gre/modules/UpdateUtils.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "gLogEnabled", function aus_gLogEnabled() {
|
||||
return getPref("getBoolPref", PREF_APP_UPDATE_LOG, false);
|
||||
return Services.prefs.getBoolPref(PREF_APP_UPDATE_LOG, false);
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "gUpdateBundle", function aus_gUpdateBundle() {
|
||||
@@ -550,7 +550,7 @@ XPCOMUtils.defineLazyGetter(this, "gCanStageUpdatesSession", function aus_gCSUS(
|
||||
*/
|
||||
function getCanStageUpdates() {
|
||||
// If staging updates are disabled, then just bail out!
|
||||
if (!getPref("getBoolPref", PREF_APP_UPDATE_STAGING_ENABLED, false)) {
|
||||
if (!Services.prefs.getBoolPref(PREF_APP_UPDATE_STAGING_ENABLED, false)) {
|
||||
LOG("getCanStageUpdates - staging updates is disabled by preference " +
|
||||
PREF_APP_UPDATE_STAGING_ENABLED);
|
||||
return false;
|
||||
@@ -584,7 +584,7 @@ XPCOMUtils.defineLazyGetter(this, "gCanCheckForUpdates", function aus_gCanCheckF
|
||||
// If the administrator has disabled app update and locked the preference so
|
||||
// users can't check for updates. This preference check is ok in this lazy
|
||||
// getter since locked prefs don't change until the application is restarted.
|
||||
var enabled = getPref("getBoolPref", PREF_APP_UPDATE_ENABLED, true);
|
||||
var enabled = Services.prefs.getBoolPref(PREF_APP_UPDATE_ENABLED, true);
|
||||
if (!enabled && Services.prefs.prefIsLocked(PREF_APP_UPDATE_ENABLED)) {
|
||||
LOG("gCanCheckForUpdates - unable to automatically check for updates, " +
|
||||
"the preference is disabled and admistratively locked.");
|
||||
@@ -620,26 +620,6 @@ function LOG(string) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @return 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a string containing binary values to hex.
|
||||
*/
|
||||
@@ -910,7 +890,7 @@ function shouldUseService() {
|
||||
// with a SHA-2 certificate and the certificate is verified before the binary
|
||||
// is launched.
|
||||
if (!AppConstants.MOZ_MAINTENANCE_SERVICE || !isServiceInstalled() ||
|
||||
!getPref("getBoolPref", PREF_APP_UPDATE_SERVICE_ENABLED, false) ||
|
||||
!Services.prefs.getBoolPref(PREF_APP_UPDATE_SERVICE_ENABLED, false) ||
|
||||
!AppConstants.isPlatformAndVersionAtLeast("win", "5.1") /* WinXP */) {
|
||||
return false;
|
||||
}
|
||||
@@ -1190,16 +1170,15 @@ function handleUpdateFailure(update, errorCode) {
|
||||
}
|
||||
|
||||
if (update.errorCode == ELEVATION_CANCELED) {
|
||||
let cancelations = getPref("getIntPref", PREF_APP_UPDATE_CANCELATIONS, 0);
|
||||
let cancelations = Services.prefs.getIntPref(PREF_APP_UPDATE_CANCELATIONS, 0);
|
||||
cancelations++;
|
||||
Services.prefs.setIntPref(PREF_APP_UPDATE_CANCELATIONS, cancelations);
|
||||
if (AppConstants.platform == "macosx") {
|
||||
let osxCancelations = getPref("getIntPref",
|
||||
PREF_APP_UPDATE_CANCELATIONS_OSX, 0);
|
||||
let osxCancelations = Services.prefs.getIntPref(PREF_APP_UPDATE_CANCELATIONS_OSX, 0);
|
||||
osxCancelations++;
|
||||
Services.prefs.setIntPref(PREF_APP_UPDATE_CANCELATIONS_OSX,
|
||||
osxCancelations);
|
||||
let maxCancels = getPref("getIntPref",
|
||||
let maxCancels = Services.prefs.getIntPref(
|
||||
PREF_APP_UPDATE_CANCELATIONS_OSX_MAX,
|
||||
DEFAULT_CANCELATIONS_OSX_MAX);
|
||||
// Prevent the preference from setting a value greater than 5.
|
||||
@@ -1231,10 +1210,8 @@ function handleUpdateFailure(update, errorCode) {
|
||||
|
||||
// Replace with Array.prototype.includes when it has stabilized.
|
||||
if (SERVICE_ERRORS.indexOf(update.errorCode) != -1) {
|
||||
var failCount = getPref("getIntPref",
|
||||
PREF_APP_UPDATE_SERVICE_ERRORS, 0);
|
||||
var maxFail = getPref("getIntPref",
|
||||
PREF_APP_UPDATE_SERVICE_MAXERRORS,
|
||||
var failCount = Services.prefs.getIntPref(PREF_APP_UPDATE_SERVICE_ERRORS, 0);
|
||||
var maxFail = Services.prefs.getIntPref(PREF_APP_UPDATE_SERVICE_MAXERRORS,
|
||||
DEFAULT_SERVICE_MAX_ERRORS);
|
||||
// Prevent the preference from setting a value greater than 10.
|
||||
maxFail = Math.min(maxFail, 10);
|
||||
@@ -1503,8 +1480,8 @@ function Update(update) {
|
||||
this.showNeverForVersion = false;
|
||||
this.unsupported = false;
|
||||
this.channel = "default";
|
||||
this.promptWaitTime = getPref("getIntPref", PREF_APP_UPDATE_PROMPTWAITTIME, 43200);
|
||||
this.backgroundInterval = getPref("getIntPref", PREF_APP_UPDATE_BACKGROUNDINTERVAL,
|
||||
this.promptWaitTime = Services.prefs.getIntPref(PREF_APP_UPDATE_PROMPTWAITTIME, 43200);
|
||||
this.backgroundInterval = Services.prefs.getIntPref(PREF_APP_UPDATE_BACKGROUNDINTERVAL,
|
||||
DOWNLOAD_BACKGROUND_INTERVAL);
|
||||
|
||||
// Null <update>, assume this is a message container and do no
|
||||
@@ -1889,7 +1866,7 @@ UpdateService.prototype = {
|
||||
break;
|
||||
case "nsPref:changed":
|
||||
if (data == PREF_APP_UPDATE_LOG) {
|
||||
gLogEnabled = getPref("getBoolPref", PREF_APP_UPDATE_LOG, false);
|
||||
gLogEnabled = Services.prefs.getBoolPref(PREF_APP_UPDATE_LOG, false);
|
||||
}
|
||||
break;
|
||||
case "profile-change-net-teardown": // fall thru
|
||||
@@ -2155,11 +2132,11 @@ UpdateService.prototype = {
|
||||
// Send the error code to telemetry
|
||||
AUSTLMY.pingCheckExError(this._pingSuffix, update.errorCode);
|
||||
update.errorCode = BACKGROUNDCHECK_MULTIPLE_FAILURES;
|
||||
let errCount = getPref("getIntPref", PREF_APP_UPDATE_BACKGROUNDERRORS, 0);
|
||||
let errCount = Services.prefs.getIntPref(PREF_APP_UPDATE_BACKGROUNDERRORS, 0);
|
||||
errCount++;
|
||||
Services.prefs.setIntPref(PREF_APP_UPDATE_BACKGROUNDERRORS, errCount);
|
||||
// Don't allow the preference to set a value greater than 20 for max errors.
|
||||
let maxErrors = Math.min(getPref("getIntPref", PREF_APP_UPDATE_BACKGROUNDMAXERRORS, 10), 20);
|
||||
let maxErrors = Math.min(Services.prefs.getIntPref(PREF_APP_UPDATE_BACKGROUNDMAXERRORS, 10), 20);
|
||||
|
||||
if (errCount >= maxErrors) {
|
||||
let prompter = Cc["@mozilla.org/updates/update-prompt;1"].
|
||||
@@ -2333,7 +2310,7 @@ UpdateService.prototype = {
|
||||
} else if (!validUpdateURL) {
|
||||
AUSTLMY.pingCheckCode(this._pingSuffix,
|
||||
AUSTLMY.CHK_INVALID_DEFAULT_URL);
|
||||
} else if (!getPref("getBoolPref", PREF_APP_UPDATE_ENABLED, true)) {
|
||||
} else if (!Services.prefs.getBoolPref(PREF_APP_UPDATE_ENABLED, true)) {
|
||||
AUSTLMY.pingCheckCode(this._pingSuffix, AUSTLMY.CHK_PREF_DISABLED);
|
||||
} else if (!hasUpdateMutex()) {
|
||||
AUSTLMY.pingCheckCode(this._pingSuffix, AUSTLMY.CHK_NO_MUTEX);
|
||||
@@ -2391,7 +2368,7 @@ UpdateService.prototype = {
|
||||
// (see bug 350636).
|
||||
let neverPrefName = PREFBRANCH_APP_UPDATE_NEVER + aUpdate.appVersion;
|
||||
if (aUpdate.showNeverForVersion &&
|
||||
getPref("getBoolPref", neverPrefName, false)) {
|
||||
Services.prefs.getBoolPref(neverPrefName, false)) {
|
||||
LOG("UpdateService:selectUpdate - skipping update because the " +
|
||||
"preference " + neverPrefName + " is true");
|
||||
lastCheckCode = AUSTLMY.CHK_UPDATE_NEVER_PREF;
|
||||
@@ -2422,7 +2399,7 @@ UpdateService.prototype = {
|
||||
let update = minorUpdate || majorUpdate;
|
||||
if (AppConstants.platform == "macosx" && update) {
|
||||
if (getElevationRequired()) {
|
||||
let installAttemptVersion = getPref("getCharPref",
|
||||
let installAttemptVersion = Services.prefs.getCharPref(
|
||||
PREF_APP_UPDATE_ELEVATE_VERSION,
|
||||
null);
|
||||
if (vc.compare(installAttemptVersion, update.appVersion) != 0) {
|
||||
@@ -2436,12 +2413,9 @@ UpdateService.prototype = {
|
||||
Services.prefs.clearUserPref(PREF_APP_UPDATE_ELEVATE_NEVER);
|
||||
}
|
||||
} else {
|
||||
let numCancels = getPref("getIntPref",
|
||||
PREF_APP_UPDATE_CANCELATIONS_OSX, 0);
|
||||
let rejectedVersion = getPref("getCharPref",
|
||||
PREF_APP_UPDATE_ELEVATE_NEVER, "");
|
||||
let maxCancels = getPref("getIntPref",
|
||||
PREF_APP_UPDATE_CANCELATIONS_OSX_MAX,
|
||||
let numCancels = Services.prefs.getIntPref(PREF_APP_UPDATE_CANCELATIONS_OSX, 0);
|
||||
let rejectedVersion = Services.prefs.getCharPref(PREF_APP_UPDATE_ELEVATE_NEVER, "");
|
||||
let maxCancels = Services.prefs.getIntPref(PREF_APP_UPDATE_CANCELATIONS_OSX_MAX,
|
||||
DEFAULT_CANCELATIONS_OSX_MAX);
|
||||
if (numCancels >= maxCancels) {
|
||||
LOG("UpdateService:selectUpdate - the user requires elevation to " +
|
||||
@@ -2505,7 +2479,7 @@ UpdateService.prototype = {
|
||||
return;
|
||||
}
|
||||
|
||||
var updateEnabled = getPref("getBoolPref", PREF_APP_UPDATE_ENABLED, true);
|
||||
var updateEnabled = Services.prefs.getBoolPref(PREF_APP_UPDATE_ENABLED, true);
|
||||
if (!updateEnabled) {
|
||||
AUSTLMY.pingCheckCode(this._pingSuffix, AUSTLMY.CHK_PREF_DISABLED);
|
||||
LOG("UpdateService:_selectAndInstallUpdate - not prompting because " +
|
||||
@@ -2521,7 +2495,7 @@ UpdateService.prototype = {
|
||||
if (update.unsupported) {
|
||||
LOG("UpdateService:_selectAndInstallUpdate - update not supported for " +
|
||||
"this system");
|
||||
if (!getPref("getBoolPref", PREF_APP_UPDATE_NOTIFIEDUNSUPPORTED, false)) {
|
||||
if (!Services.prefs.getBoolPref(PREF_APP_UPDATE_NOTIFIEDUNSUPPORTED, false)) {
|
||||
LOG("UpdateService:_selectAndInstallUpdate - notifying that the " +
|
||||
"update is not supported for this system");
|
||||
this._showPrompt(update);
|
||||
@@ -2562,7 +2536,7 @@ UpdateService.prototype = {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!getPref("getBoolPref", PREF_APP_UPDATE_AUTO, true)) {
|
||||
if (!Services.prefs.getBoolPref(PREF_APP_UPDATE_AUTO, true)) {
|
||||
LOG("UpdateService:_selectAndInstallUpdate - prompting because silent " +
|
||||
"install is disabled");
|
||||
AUSTLMY.pingCheckCode(this._pingSuffix, AUSTLMY.CHK_SHOWPROMPT_PREF);
|
||||
@@ -3129,7 +3103,7 @@ UpdateManager.prototype = {
|
||||
return;
|
||||
}
|
||||
// Only prompt when the UI isn't already open.
|
||||
let windowType = getPref("getCharPref", PREF_APP_UPDATE_ALTWINDOWTYPE, null);
|
||||
let windowType = Services.prefs.getCharPref(PREF_APP_UPDATE_ALTWINDOWTYPE, null);
|
||||
if (Services.wm.getMostRecentWindow(UPDATE_WINDOW_NAME) ||
|
||||
windowType && Services.wm.getMostRecentWindow(windowType)) {
|
||||
return;
|
||||
@@ -3408,7 +3382,7 @@ Checker.prototype = {
|
||||
*/
|
||||
_enabled: true,
|
||||
get enabled() {
|
||||
return getPref("getBoolPref", PREF_APP_UPDATE_ENABLED, true) &&
|
||||
return Services.prefs.getBoolPref(PREF_APP_UPDATE_ENABLED, true) &&
|
||||
gCanCheckForUpdates && hasUpdateMutex() && this._enabled;
|
||||
},
|
||||
|
||||
@@ -3992,11 +3966,11 @@ Downloader.prototype = {
|
||||
var shouldRegisterOnlineObserver = false;
|
||||
var shouldRetrySoon = false;
|
||||
var deleteActiveUpdate = false;
|
||||
var retryTimeout = getPref("getIntPref", PREF_APP_UPDATE_SOCKET_RETRYTIMEOUT,
|
||||
var retryTimeout = Services.prefs.getIntPref(PREF_APP_UPDATE_SOCKET_RETRYTIMEOUT,
|
||||
DEFAULT_SOCKET_RETRYTIMEOUT);
|
||||
// Prevent the preference from setting a value greater than 10000.
|
||||
retryTimeout = Math.min(retryTimeout, 10000);
|
||||
var maxFail = getPref("getIntPref", PREF_APP_UPDATE_SOCKET_MAXERRORS,
|
||||
var maxFail = Services.prefs.getIntPref(PREF_APP_UPDATE_SOCKET_MAXERRORS,
|
||||
DEFAULT_SOCKET_MAX_ERRORS);
|
||||
// Prevent the preference from setting a value greater than 20.
|
||||
maxFail = Math.min(maxFail, 20);
|
||||
@@ -4266,7 +4240,7 @@ UpdatePrompt.prototype = {
|
||||
* See nsIUpdateService.idl
|
||||
*/
|
||||
showUpdateAvailable: function UP_showUpdateAvailable(update) {
|
||||
if (getPref("getBoolPref", PREF_APP_UPDATE_SILENT, false) ||
|
||||
if (Services.prefs.getBoolPref(PREF_APP_UPDATE_SILENT, false) ||
|
||||
this._getUpdateWindow() || this._getAltUpdateWindow()) {
|
||||
return;
|
||||
}
|
||||
@@ -4279,7 +4253,7 @@ UpdatePrompt.prototype = {
|
||||
* See nsIUpdateService.idl
|
||||
*/
|
||||
showUpdateDownloaded: function UP_showUpdateDownloaded(update, background) {
|
||||
if (background && getPref("getBoolPref", PREF_APP_UPDATE_SILENT, false)) {
|
||||
if (background && Services.prefs.getBoolPref(PREF_APP_UPDATE_SILENT, false)) {
|
||||
return;
|
||||
}
|
||||
// Trigger the display of the hamburger menu badge.
|
||||
@@ -4301,7 +4275,7 @@ UpdatePrompt.prototype = {
|
||||
* See nsIUpdateService.idl
|
||||
*/
|
||||
showUpdateError: function UP_showUpdateError(update) {
|
||||
if (getPref("getBoolPref", PREF_APP_UPDATE_SILENT, false) ||
|
||||
if (Services.prefs.getBoolPref(PREF_APP_UPDATE_SILENT, false) ||
|
||||
this._getAltUpdateWindow())
|
||||
return;
|
||||
|
||||
@@ -4344,7 +4318,7 @@ UpdatePrompt.prototype = {
|
||||
* See nsIUpdateService.idl
|
||||
*/
|
||||
showUpdateElevationRequired: function UP_showUpdateElevationRequired() {
|
||||
if (getPref("getBoolPref", PREF_APP_UPDATE_SILENT, false) ||
|
||||
if (Services.prefs.getBoolPref(PREF_APP_UPDATE_SILENT, false) ||
|
||||
this._getAltUpdateWindow()) {
|
||||
return;
|
||||
}
|
||||
@@ -4368,7 +4342,7 @@ UpdatePrompt.prototype = {
|
||||
* application update user interface window.
|
||||
*/
|
||||
_getAltUpdateWindow: function UP__getAltUpdateWindow() {
|
||||
let windowType = getPref("getCharPref", PREF_APP_UPDATE_ALTWINDOWTYPE, null);
|
||||
let windowType = Services.prefs.getCharPref(PREF_APP_UPDATE_ALTWINDOWTYPE, null);
|
||||
if (!windowType)
|
||||
return null;
|
||||
return Services.wm.getMostRecentWindow(windowType);
|
||||
@@ -4420,7 +4394,7 @@ UpdatePrompt.prototype = {
|
||||
var idleService = Cc["@mozilla.org/widget/idleservice;1"].
|
||||
getService(Ci.nsIIdleService);
|
||||
// Don't allow the preference to set a value greater than 600 seconds for the idle time.
|
||||
const IDLE_TIME = Math.min(getPref("getIntPref", PREF_APP_UPDATE_IDLETIME, 60), 600);
|
||||
const IDLE_TIME = Math.min(Services.prefs.getIntPref(PREF_APP_UPDATE_IDLETIME, 60), 600);
|
||||
if (idleService.idleTime / 1000 >= IDLE_TIME) {
|
||||
this._showUI(parent, uri, features, name, page, update);
|
||||
return;
|
||||
@@ -4465,7 +4439,7 @@ UpdatePrompt.prototype = {
|
||||
getService(Ci.nsIIdleService);
|
||||
|
||||
// Don't allow the preference to set a value greater than 600 seconds for the idle time.
|
||||
const IDLE_TIME = Math.min(getPref("getIntPref", PREF_APP_UPDATE_IDLETIME, 60), 600);
|
||||
const IDLE_TIME = Math.min(Services.prefs.getIntPref(PREF_APP_UPDATE_IDLETIME, 60), 600);
|
||||
if (idleService.idleTime / 1000 >= IDLE_TIME) {
|
||||
this._showUI(parent, uri, features, name, page, update);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user