mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-27 17:47:34 +09:00
Remove obsolete getPref helpers.
This commit is contained in:
parent
a85e8de713
commit
8d45fa6874
15 changed files with 103 additions and 307 deletions
|
|
@ -1282,7 +1282,7 @@ var gBrowserInit = {
|
||||||
|
|
||||||
// Setup click-and-hold gestures access to the session history
|
// Setup click-and-hold gestures access to the session history
|
||||||
// menus if global click-and-hold isn't turned on
|
// 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();
|
SetClickAndHoldHandlers();
|
||||||
|
|
||||||
let NP = {};
|
let NP = {};
|
||||||
|
|
@ -1873,7 +1873,7 @@ function BrowserGoHome(aEvent) {
|
||||||
case "tabshifted":
|
case "tabshifted":
|
||||||
case "tab":
|
case "tab":
|
||||||
urls = homePage.split("|");
|
urls = homePage.split("|");
|
||||||
var loadInBackground = getBoolPref("browser.tabs.loadBookmarksInBackground", false);
|
var loadInBackground = Services.prefs.getBoolPref("browser.tabs.loadBookmarksInBackground", false);
|
||||||
gBrowser.loadTabs(urls, loadInBackground);
|
gBrowser.loadTabs(urls, loadInBackground);
|
||||||
break;
|
break;
|
||||||
case "window":
|
case "window":
|
||||||
|
|
|
||||||
|
|
@ -61,16 +61,6 @@ function openTopWin(url) {
|
||||||
openUILinkIn(url, "current");
|
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.
|
/* 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
|
* As the third argument, you may pass an object with the same properties as
|
||||||
|
|
@ -137,7 +127,7 @@ function whereToOpenLink( e, ignoreButton, ignoreAlt )
|
||||||
|
|
||||||
// ignoreButton allows "middle-click paste" to use function without always opening in a new window.
|
// ignoreButton allows "middle-click paste" to use function without always opening in a new window.
|
||||||
var middle = !ignoreButton && e.button == 1;
|
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.
|
// Don't do anything special with right-mouse clicks. They're probably clicks on context menu items.
|
||||||
|
|
||||||
|
|
@ -145,7 +135,7 @@ function whereToOpenLink( e, ignoreButton, ignoreAlt )
|
||||||
if (metaKey || (middle && middleUsesTabs))
|
if (metaKey || (middle && middleUsesTabs))
|
||||||
return shift ? "tabshifted" : "tab";
|
return shift ? "tabshifted" : "tab";
|
||||||
|
|
||||||
if (alt && getBoolPref("browser.altClickSave", false))
|
if (alt && Services.prefs.getBoolPref("browser.altClickSave", false))
|
||||||
return "save";
|
return "save";
|
||||||
|
|
||||||
if (shift || (middle && !middleUsesTabs))
|
if (shift || (middle && !middleUsesTabs))
|
||||||
|
|
@ -342,7 +332,7 @@ function openLinkIn(url, where, params) {
|
||||||
if (loadInBackground == null) {
|
if (loadInBackground == null) {
|
||||||
loadInBackground = aFromChrome ?
|
loadInBackground = aFromChrome ?
|
||||||
false :
|
false :
|
||||||
getBoolPref("browser.tabs.loadInBackground");
|
Services.prefs.getBoolPref("browser.tabs.loadInBackground");
|
||||||
}
|
}
|
||||||
|
|
||||||
let uriObj;
|
let uriObj;
|
||||||
|
|
@ -652,7 +642,7 @@ function getShellService()
|
||||||
|
|
||||||
function isBidiEnabled() {
|
function isBidiEnabled() {
|
||||||
// first check the pref.
|
// first check the pref.
|
||||||
if (getBoolPref("bidi.browser.ui", false))
|
if (Services.prefs.getBoolPref("bidi.browser.ui", false))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// then check intl.uidirection.<locale>
|
// then check intl.uidirection.<locale>
|
||||||
|
|
@ -914,7 +904,7 @@ function openHelpLink(aHelpTopic, aCalledFromModal, aWhere) {
|
||||||
function openPrefsHelp() {
|
function openPrefsHelp() {
|
||||||
// non-instant apply prefwindows are usually modal, so we can't open in the topmost window,
|
// non-instant apply prefwindows are usually modal, so we can't open in the topmost window,
|
||||||
// since its probably behind the 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;
|
var helpTopic = document.getElementsByTagName("prefwindow")[0].currentPane.helpTopic;
|
||||||
openHelpLink(helpTopic, !instantApply);
|
openHelpLink(helpTopic, !instantApply);
|
||||||
|
|
|
||||||
|
|
@ -52,23 +52,6 @@ XPCOMUtils.defineLazyModuleGetter(this, 'PdfjsChromeUtils',
|
||||||
'resource://pdf.js/PdfjsChromeUtils.jsm');
|
'resource://pdf.js/PdfjsChromeUtils.jsm');
|
||||||
XPCOMUtils.defineLazyModuleGetter(this, 'PdfjsContentUtils',
|
XPCOMUtils.defineLazyModuleGetter(this, 'PdfjsContentUtils',
|
||||||
'resource://pdf.js/PdfjsContentUtils.jsm');
|
'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() {
|
function isDefaultHandler() {
|
||||||
if (Services.appinfo.processType === Services.appinfo.PROCESS_TYPE_CONTENT) {
|
if (Services.appinfo.processType === Services.appinfo.PROCESS_TYPE_CONTENT) {
|
||||||
return PdfjsContentUtils.isDefaultHandlerApp();
|
return PdfjsContentUtils.isDefaultHandlerApp();
|
||||||
|
|
@ -172,7 +155,7 @@ var PdfJs = {
|
||||||
}
|
}
|
||||||
this._initialized = true;
|
this._initialized = true;
|
||||||
|
|
||||||
if (!getBoolPref(PREF_DISABLED, true)) {
|
if (!Services.prefs.getBoolPref(PREF_DISABLED, true)) {
|
||||||
this._migrate();
|
this._migrate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -209,7 +192,7 @@ var PdfJs = {
|
||||||
|
|
||||||
_migrate: function migrate() {
|
_migrate: function migrate() {
|
||||||
const VERSION = 2;
|
const VERSION = 2;
|
||||||
var currentVersion = getIntPref(PREF_MIGRATION_VERSION, 0);
|
var currentVersion = Services.prefs.getIntPref(PREF_MIGRATION_VERSION, 0);
|
||||||
if (currentVersion >= VERSION) {
|
if (currentVersion >= VERSION) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -284,7 +267,7 @@ var PdfJs = {
|
||||||
* @return {boolean} Whether or not it's enabled.
|
* @return {boolean} Whether or not it's enabled.
|
||||||
*/
|
*/
|
||||||
get enabled() {
|
get enabled() {
|
||||||
var disabled = getBoolPref(PREF_DISABLED, true);
|
var disabled = Services.prefs.getBoolPref(PREF_DISABLED, true);
|
||||||
if (disabled) {
|
if (disabled) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -78,22 +78,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) {
|
function getStringPref(pref, def) {
|
||||||
try {
|
try {
|
||||||
return Services.prefs.getComplexValue(pref, Ci.nsISupportsString).data;
|
return Services.prefs.getComplexValue(pref, Ci.nsISupportsString).data;
|
||||||
|
|
@ -103,7 +87,7 @@ function getStringPref(pref, def) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function log(aMsg) {
|
function log(aMsg) {
|
||||||
if (!getBoolPref(PREF_PREFIX + '.pdfBugEnabled', false)) {
|
if (!Services.prefs.getBoolPref(PREF_PREFIX + '.pdfBugEnabled', false)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var msg = 'PdfStreamConverter.js: ' + (aMsg.join ? aMsg.join('') : aMsg);
|
var msg = 'PdfStreamConverter.js: ' + (aMsg.join ? aMsg.join('') : aMsg);
|
||||||
|
|
@ -359,17 +343,17 @@ ChromeActions.prototype = {
|
||||||
return !!findBar && ('updateControlState' in findBar);
|
return !!findBar && ('updateControlState' in findBar);
|
||||||
},
|
},
|
||||||
supportsDocumentFonts: function() {
|
supportsDocumentFonts: function() {
|
||||||
var prefBrowser = getIntPref('browser.display.use_document_fonts', 1);
|
var prefBrowser = Services.prefs.getIntPref('browser.display.use_document_fonts', 1);
|
||||||
var prefGfx = getBoolPref('gfx.downloadable_fonts.enabled', true);
|
var prefGfx = Services.prefs.getBoolPref('gfx.downloadable_fonts.enabled', true);
|
||||||
return (!!prefBrowser && prefGfx);
|
return (!!prefBrowser && prefGfx);
|
||||||
},
|
},
|
||||||
supportsDocumentColors: function() {
|
supportsDocumentColors: function() {
|
||||||
return getIntPref('browser.display.document_color_use', 0) !== 2;
|
return Services.prefs.getIntPref('browser.display.document_color_use', 0) !== 2;
|
||||||
},
|
},
|
||||||
supportedMouseWheelZoomModifierKeys: function() {
|
supportedMouseWheelZoomModifierKeys: function() {
|
||||||
return {
|
return {
|
||||||
ctrlKey: getIntPref('mousewheel.with_control.action', 3) === 3,
|
ctrlKey: Services.prefs.getIntPref('mousewheel.with_control.action', 3) === 3,
|
||||||
metaKey: getIntPref('mousewheel.with_meta.action', 1) === 3,
|
metaKey: Services.prefs.getIntPref('mousewheel.with_meta.action', 1) === 3,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
reportTelemetry: function (data) {
|
reportTelemetry: function (data) {
|
||||||
|
|
@ -531,10 +515,10 @@ ChromeActions.prototype = {
|
||||||
prefName = (PREF_PREFIX + '.' + key);
|
prefName = (PREF_PREFIX + '.' + key);
|
||||||
switch (typeof prefValue) {
|
switch (typeof prefValue) {
|
||||||
case 'boolean':
|
case 'boolean':
|
||||||
currentPrefs[key] = getBoolPref(prefName, prefValue);
|
currentPrefs[key] = Services.prefs.getBoolPref(prefName, prefValue);
|
||||||
break;
|
break;
|
||||||
case 'number':
|
case 'number':
|
||||||
currentPrefs[key] = getIntPref(prefName, prefValue);
|
currentPrefs[key] = Services.prefs.getIntPref(prefName, prefValue);
|
||||||
break;
|
break;
|
||||||
case 'string':
|
case 'string':
|
||||||
currentPrefs[key] = getStringPref(prefName, prefValue);
|
currentPrefs[key] = getStringPref(prefName, prefValue);
|
||||||
|
|
@ -921,16 +905,16 @@ PdfStreamConverter.prototype = {
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
|
|
||||||
var hash = aRequest.URI.ref;
|
var hash = aRequest.URI.ref;
|
||||||
var isPDFBugEnabled = getBoolPref(PREF_PREFIX + '.pdfBugEnabled', false);
|
var isPDFBugEnabled = Services.prefs.getBoolPref(PREF_PREFIX + '.pdfBugEnabled', false);
|
||||||
rangeRequest = contentEncoding === 'identity' &&
|
rangeRequest = contentEncoding === 'identity' &&
|
||||||
acceptRanges === 'bytes' &&
|
acceptRanges === 'bytes' &&
|
||||||
aRequest.contentLength >= 0 &&
|
aRequest.contentLength >= 0 &&
|
||||||
!getBoolPref(PREF_PREFIX + '.disableRange', false) &&
|
!Services.prefs.getBoolPref(PREF_PREFIX + '.disableRange', false) &&
|
||||||
(!isPDFBugEnabled ||
|
(!isPDFBugEnabled ||
|
||||||
hash.toLowerCase().indexOf('disablerange=true') < 0);
|
hash.toLowerCase().indexOf('disablerange=true') < 0);
|
||||||
streamRequest = contentEncoding === 'identity' &&
|
streamRequest = contentEncoding === 'identity' &&
|
||||||
aRequest.contentLength >= 0 &&
|
aRequest.contentLength >= 0 &&
|
||||||
!getBoolPref(PREF_PREFIX + '.disableStream', false) &&
|
!Services.prefs.getBoolPref(PREF_PREFIX + '.disableStream', false) &&
|
||||||
(!isPDFBugEnabled ||
|
(!isPDFBugEnabled ||
|
||||||
hash.toLowerCase().indexOf('disablestream=true') < 0);
|
hash.toLowerCase().indexOf('disablestream=true') < 0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,11 +52,9 @@ var browserMenuDragging = {
|
||||||
|
|
||||||
initPref: function(){
|
initPref: function(){
|
||||||
this.STAY_OPEN_ONDRAGEXIT =
|
this.STAY_OPEN_ONDRAGEXIT =
|
||||||
this.getPref('browser.menu.dragging.stayOpen',
|
Services.prefs.getBoolPref('browser.menu.dragging.stayOpen', false);
|
||||||
'bool', false);
|
|
||||||
this.DEBUG =
|
this.DEBUG =
|
||||||
this.getPref('browser.menu.dragging.debug',
|
Services.prefs.getBoolPref('browser.menu.dragging.debug', false);
|
||||||
'bool', false);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
//delayed startup
|
//delayed startup
|
||||||
|
|
@ -291,26 +289,6 @@ var browserMenuDragging = {
|
||||||
.logStringMessage(aMsg);
|
.logStringMessage(aMsg);
|
||||||
},
|
},
|
||||||
|
|
||||||
getPref: function(aPrefString, aPrefType, aDefault){
|
|
||||||
var xpPref = Components.classes["@mozilla.org/preferences-service;1"]
|
|
||||||
.getService(Components.interfaces.nsIPrefService);
|
|
||||||
try{
|
|
||||||
switch (aPrefType){
|
|
||||||
case 'complex':
|
|
||||||
return xpPref.getComplexValue(aPrefString, Components.interfaces.nsILocalFile); break;
|
|
||||||
case 'str':
|
|
||||||
return xpPref.getCharPref(aPrefString).toString(); break;
|
|
||||||
case 'int':
|
|
||||||
return xpPref.getIntPref(aPrefString); break;
|
|
||||||
case 'bool':
|
|
||||||
default:
|
|
||||||
return xpPref.getBoolPref(aPrefString); break;
|
|
||||||
}
|
|
||||||
}catch(e){
|
|
||||||
}
|
|
||||||
return aDefault;
|
|
||||||
},
|
|
||||||
|
|
||||||
setPref: function(aPrefString, aPrefType, aValue){
|
setPref: function(aPrefString, aPrefType, aValue){
|
||||||
var xpPref = Components.classes["@mozilla.org/preferences-service;1"]
|
var xpPref = Components.classes["@mozilla.org/preferences-service;1"]
|
||||||
.getService(Components.interfaces.nsIPrefService);
|
.getService(Components.interfaces.nsIPrefService);
|
||||||
|
|
|
||||||
|
|
@ -1147,7 +1147,7 @@ var gBrowserInit = {
|
||||||
|
|
||||||
// Setup click-and-hold gestures access to the session history
|
// Setup click-and-hold gestures access to the session history
|
||||||
// menus if global click-and-hold isn't turned on
|
// 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();
|
SetClickAndHoldHandlers();
|
||||||
|
|
||||||
// Initialize the full zoom setting.
|
// Initialize the full zoom setting.
|
||||||
|
|
@ -1783,7 +1783,7 @@ function BrowserGoHome(aEvent) {
|
||||||
case "tabshifted":
|
case "tabshifted":
|
||||||
case "tab":
|
case "tab":
|
||||||
urls = homePage.split("|");
|
urls = homePage.split("|");
|
||||||
var loadInBackground = getBoolPref("browser.tabs.loadBookmarksInBackground", false);
|
var loadInBackground = Services.prefs.getBoolPref("browser.tabs.loadBookmarksInBackground", false);
|
||||||
gBrowser.loadTabs(urls, loadInBackground);
|
gBrowser.loadTabs(urls, loadInBackground);
|
||||||
break;
|
break;
|
||||||
case "window":
|
case "window":
|
||||||
|
|
@ -3402,7 +3402,7 @@ function BrowserCustomizeToolbar() {
|
||||||
TabsInTitlebar.allowedBy("customizing-toolbars", false);
|
TabsInTitlebar.allowedBy("customizing-toolbars", false);
|
||||||
|
|
||||||
var customizeURL = "chrome://global/content/customizeToolbar.xul";
|
var customizeURL = "chrome://global/content/customizeToolbar.xul";
|
||||||
gCustomizeSheet = getBoolPref("toolbar.customization.usesheet", false);
|
gCustomizeSheet = Services.prefs.getBoolPref("toolbar.customization.usesheet", false);
|
||||||
|
|
||||||
if (gCustomizeSheet) {
|
if (gCustomizeSheet) {
|
||||||
let sheetFrame = document.createElement("iframe");
|
let sheetFrame = document.createElement("iframe");
|
||||||
|
|
@ -3486,7 +3486,7 @@ function BrowserToolboxCustomizeDone(aToolboxChanged) {
|
||||||
cmd.removeAttribute("disabled");
|
cmd.removeAttribute("disabled");
|
||||||
|
|
||||||
// make sure to re-enable click-and-hold
|
// make sure to re-enable click-and-hold
|
||||||
if (!getBoolPref("ui.click_hold_context_menus", false))
|
if (!Services.prefs.getBoolPref("ui.click_hold_context_menus", false))
|
||||||
SetClickAndHoldHandlers();
|
SetClickAndHoldHandlers();
|
||||||
|
|
||||||
gBrowser.selectedBrowser.focus();
|
gBrowser.selectedBrowser.focus();
|
||||||
|
|
|
||||||
|
|
@ -75,16 +75,6 @@ function openTopWin(url) {
|
||||||
openUILinkIn(url, "current");
|
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.
|
/* 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
|
* As the third argument, you may pass an object with the same properties as
|
||||||
|
|
@ -151,7 +141,7 @@ function whereToOpenLink( e, ignoreButton, ignoreAlt )
|
||||||
|
|
||||||
// ignoreButton allows "middle-click paste" to use function without always opening in a new window.
|
// ignoreButton allows "middle-click paste" to use function without always opening in a new window.
|
||||||
var middle = !ignoreButton && e.button == 1;
|
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.
|
// Don't do anything special with right-mouse clicks. They're probably clicks on context menu items.
|
||||||
|
|
||||||
|
|
@ -162,7 +152,7 @@ function whereToOpenLink( e, ignoreButton, ignoreAlt )
|
||||||
#endif
|
#endif
|
||||||
return shift ? "tabshifted" : "tab";
|
return shift ? "tabshifted" : "tab";
|
||||||
|
|
||||||
if (alt && getBoolPref("browser.altClickSave", false))
|
if (alt && Services.prefs.getBoolPref("browser.altClickSave", false))
|
||||||
return "save";
|
return "save";
|
||||||
|
|
||||||
if (shift || (middle && !middleUsesTabs))
|
if (shift || (middle && !middleUsesTabs))
|
||||||
|
|
@ -334,7 +324,7 @@ function openLinkIn(url, where, params) {
|
||||||
if (loadInBackground == null) {
|
if (loadInBackground == null) {
|
||||||
loadInBackground = aFromChrome ?
|
loadInBackground = aFromChrome ?
|
||||||
false :
|
false :
|
||||||
getBoolPref("browser.tabs.loadInBackground");
|
Services.prefs.getBoolPref("browser.tabs.loadInBackground");
|
||||||
}
|
}
|
||||||
|
|
||||||
let uriObj;
|
let uriObj;
|
||||||
|
|
@ -515,7 +505,7 @@ function getShellService()
|
||||||
|
|
||||||
function isBidiEnabled() {
|
function isBidiEnabled() {
|
||||||
// first check the pref.
|
// first check the pref.
|
||||||
if (getBoolPref("bidi.browser.ui", false))
|
if (Services.prefs.getBoolPref("bidi.browser.ui", false))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// if the pref isn't set, check for an RTL locale and force the pref to true
|
// if the pref isn't set, check for an RTL locale and force the pref to true
|
||||||
|
|
@ -673,7 +663,7 @@ function openAboutDialog() {
|
||||||
|
|
||||||
function openPreferences(paneID, extraArgs)
|
function openPreferences(paneID, extraArgs)
|
||||||
{
|
{
|
||||||
var instantApply = getBoolPref("browser.preferences.instantApply", false);
|
var instantApply = Services.prefs.getBoolPref("browser.preferences.instantApply", false);
|
||||||
var features = "chrome,titlebar,toolbar,centerscreen" + (instantApply ? ",dialog=no" : ",modal");
|
var features = "chrome,titlebar,toolbar,centerscreen" + (instantApply ? ",dialog=no" : ",modal");
|
||||||
|
|
||||||
var win = Services.wm.getMostRecentWindow("Browser:Preferences");
|
var win = Services.wm.getMostRecentWindow("Browser:Preferences");
|
||||||
|
|
@ -854,7 +844,7 @@ function openHelpLink(aHelpTopic, aCalledFromModal) {
|
||||||
function openPrefsHelp() {
|
function openPrefsHelp() {
|
||||||
// non-instant apply prefwindows are usually modal, so we can't open in the topmost window,
|
// non-instant apply prefwindows are usually modal, so we can't open in the topmost window,
|
||||||
// since its probably behind the 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;
|
var helpTopic = document.getElementsByTagName("prefwindow")[0].currentPane.helpTopic;
|
||||||
openHelpLink(helpTopic, !instantApply);
|
openHelpLink(helpTopic, !instantApply);
|
||||||
|
|
|
||||||
|
|
@ -23,15 +23,6 @@ function debug(msg) {
|
||||||
//dump("BrowserElementParent - " + msg + "\n");
|
//dump("BrowserElementParent - " + msg + "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
function getIntPref(prefName, def) {
|
|
||||||
try {
|
|
||||||
return Services.prefs.getIntPref(prefName);
|
|
||||||
}
|
|
||||||
catch(err) {
|
|
||||||
return def;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleWindowEvent(e) {
|
function handleWindowEvent(e) {
|
||||||
if (this._browserElementParents) {
|
if (this._browserElementParents) {
|
||||||
let beps = ThreadSafeChromeUtils.nondeterministicGetWeakMapKeys(this._browserElementParents);
|
let beps = ThreadSafeChromeUtils.nondeterministicGetWeakMapKeys(this._browserElementParents);
|
||||||
|
|
@ -856,8 +847,8 @@ BrowserElementParent.prototype = {
|
||||||
*/
|
*/
|
||||||
zoom: defineNoReturnMethod(function(zoom) {
|
zoom: defineNoReturnMethod(function(zoom) {
|
||||||
zoom *= 100;
|
zoom *= 100;
|
||||||
zoom = Math.min(getIntPref("zoom.maxPercent", 300), zoom);
|
zoom = Math.min(Services.prefs.getIntPref("zoom.maxPercent", 300), zoom);
|
||||||
zoom = Math.max(getIntPref("zoom.minPercent", 50), zoom);
|
zoom = Math.max(Services.prefs.getIntPref("zoom.minPercent", 50), zoom);
|
||||||
this._sendAsyncMsg('zoom', {zoom: zoom / 100.0});
|
this._sendAsyncMsg('zoom', {zoom: zoom / 100.0});
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,14 +23,6 @@ XPCOMUtils.defineLazyModuleGetter(this, "Messaging",
|
||||||
|
|
||||||
XPCOMUtils.defineLazyModuleGetter(this, "OS", "resource://gre/modules/osfile.jsm");
|
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
|
// Add-on auto-update management service
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
|
|
@ -49,7 +41,7 @@ AddonUpdateService.prototype = {
|
||||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsITimerCallback]),
|
QueryInterface: XPCOMUtils.generateQI([Ci.nsITimerCallback]),
|
||||||
|
|
||||||
notify: function aus_notify(aTimer) {
|
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;
|
return;
|
||||||
|
|
||||||
// If we already auto-upgraded and installed new versions, ignore this check
|
// If we already auto-upgraded and installed new versions, ignore this check
|
||||||
|
|
@ -61,7 +53,7 @@ AddonUpdateService.prototype = {
|
||||||
let gmp = new GMPInstallManager();
|
let gmp = new GMPInstallManager();
|
||||||
gmp.simpleCheckAndInstall().then(null, () => {});
|
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);
|
||||||
Messaging.sendRequest({
|
Messaging.sendRequest({
|
||||||
type: "Gecko:ScheduleRun",
|
type: "Gecko:ScheduleRun",
|
||||||
action: "update-addons",
|
action: "update-addons",
|
||||||
|
|
|
||||||
|
|
@ -173,27 +173,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
|
|
||||||
* @returns The value of the preference, or undefined if there was no
|
|
||||||
* user or default value.
|
|
||||||
*/
|
|
||||||
function getPref(func, preference, defaultValue) {
|
|
||||||
try {
|
|
||||||
return gPref[func](preference);
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
}
|
|
||||||
return defaultValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a URI to a spec.
|
* Constructs a URI to a spec.
|
||||||
* @param spec
|
* @param spec
|
||||||
|
|
@ -302,9 +281,9 @@ function parseRegExp(aStr) {
|
||||||
function Blocklist() {
|
function Blocklist() {
|
||||||
Services.obs.addObserver(this, "xpcom-shutdown", false);
|
Services.obs.addObserver(this, "xpcom-shutdown", false);
|
||||||
Services.obs.addObserver(this, "sessionstore-windows-restored", false);
|
Services.obs.addObserver(this, "sessionstore-windows-restored", false);
|
||||||
gLoggingEnabled = getPref("getBoolPref", PREF_EM_LOGGING_ENABLED, false);
|
gLoggingEnabled = Services.prefs.getBoolPref(PREF_EM_LOGGING_ENABLED, false);
|
||||||
gBlocklistEnabled = getPref("getBoolPref", PREF_BLOCKLIST_ENABLED, true);
|
gBlocklistEnabled = Services.prefs.getBoolPref(PREF_BLOCKLIST_ENABLED, true);
|
||||||
gBlocklistLevel = Math.min(getPref("getIntPref", PREF_BLOCKLIST_LEVEL, DEFAULT_LEVEL),
|
gBlocklistLevel = Math.min(Services.prefs.getIntPref(PREF_BLOCKLIST_LEVEL, DEFAULT_LEVEL),
|
||||||
MAX_BLOCK_LEVEL);
|
MAX_BLOCK_LEVEL);
|
||||||
gPref.addObserver("extensions.blocklist.", this, false);
|
gPref.addObserver("extensions.blocklist.", this, false);
|
||||||
gPref.addObserver(PREF_EM_LOGGING_ENABLED, this, false);
|
gPref.addObserver(PREF_EM_LOGGING_ENABLED, this, false);
|
||||||
|
|
@ -350,15 +329,15 @@ Blocklist.prototype = {
|
||||||
case "nsPref:changed":
|
case "nsPref:changed":
|
||||||
switch (aData) {
|
switch (aData) {
|
||||||
case PREF_EM_LOGGING_ENABLED:
|
case PREF_EM_LOGGING_ENABLED:
|
||||||
gLoggingEnabled = getPref("getBoolPref", PREF_EM_LOGGING_ENABLED, false);
|
gLoggingEnabled = Services.prefs.getBoolPref(PREF_EM_LOGGING_ENABLED, false);
|
||||||
break;
|
break;
|
||||||
case PREF_BLOCKLIST_ENABLED:
|
case PREF_BLOCKLIST_ENABLED:
|
||||||
gBlocklistEnabled = getPref("getBoolPref", PREF_BLOCKLIST_ENABLED, true);
|
gBlocklistEnabled = Services.prefs.getBoolPref(PREF_BLOCKLIST_ENABLED, true);
|
||||||
this._loadBlocklist();
|
this._loadBlocklist();
|
||||||
this._blocklistUpdated(null, null);
|
this._blocklistUpdated(null, null);
|
||||||
break;
|
break;
|
||||||
case PREF_BLOCKLIST_LEVEL:
|
case PREF_BLOCKLIST_LEVEL:
|
||||||
gBlocklistLevel = Math.min(getPref("getIntPref", PREF_BLOCKLIST_LEVEL, DEFAULT_LEVEL),
|
gBlocklistLevel = Math.min(Services.prefs.getIntPref(PREF_BLOCKLIST_LEVEL, DEFAULT_LEVEL),
|
||||||
MAX_BLOCK_LEVEL);
|
MAX_BLOCK_LEVEL);
|
||||||
this._blocklistUpdated(null, null);
|
this._blocklistUpdated(null, null);
|
||||||
break;
|
break;
|
||||||
|
|
@ -530,8 +509,8 @@ Blocklist.prototype = {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var pingCountVersion = getPref("getIntPref", PREF_BLOCKLIST_PINGCOUNTVERSION, 0);
|
var pingCountVersion = Services.prefs.getIntPref(PREF_BLOCKLIST_PINGCOUNTVERSION, 0);
|
||||||
var pingCountTotal = getPref("getIntPref", PREF_BLOCKLIST_PINGCOUNTTOTAL, 1);
|
var pingCountTotal = Services.prefs.getIntPref(PREF_BLOCKLIST_PINGCOUNTTOTAL, 1);
|
||||||
var daysSinceLastPing = 0;
|
var daysSinceLastPing = 0;
|
||||||
if (pingCountVersion == 0) {
|
if (pingCountVersion == 0) {
|
||||||
daysSinceLastPing = "new";
|
daysSinceLastPing = "new";
|
||||||
|
|
@ -540,7 +519,7 @@ Blocklist.prototype = {
|
||||||
// Seconds in one day is used because nsIUpdateTimerManager stores the
|
// Seconds in one day is used because nsIUpdateTimerManager stores the
|
||||||
// last update time in seconds.
|
// last update time in seconds.
|
||||||
let secondsInDay = 60 * 60 * 24;
|
let secondsInDay = 60 * 60 * 24;
|
||||||
let lastUpdateTime = getPref("getIntPref", PREF_BLOCKLIST_LASTUPDATETIME, 0);
|
let lastUpdateTime = Services.prefs.getIntPref(PREF_BLOCKLIST_LASTUPDATETIME, 0);
|
||||||
if (lastUpdateTime == 0) {
|
if (lastUpdateTime == 0) {
|
||||||
daysSinceLastPing = "invalid";
|
daysSinceLastPing = "invalid";
|
||||||
}
|
}
|
||||||
|
|
@ -903,7 +882,7 @@ Blocklist.prototype = {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var populateCertBlocklist = getPref("getBoolPref", PREF_ONECRL_VIA_AMO, true);
|
var populateCertBlocklist = Services.prefs.getBoolPref(PREF_ONECRL_VIA_AMO, true);
|
||||||
|
|
||||||
var childNodes = doc.documentElement.childNodes;
|
var childNodes = doc.documentElement.childNodes;
|
||||||
for (let element of childNodes) {
|
for (let element of childNodes) {
|
||||||
|
|
@ -1475,7 +1454,7 @@ Blocklist.prototype = {
|
||||||
|
|
||||||
Services.obs.addObserver(applyBlocklistChanges, "addon-blocklist-closed", false);
|
Services.obs.addObserver(applyBlocklistChanges, "addon-blocklist-closed", false);
|
||||||
|
|
||||||
if (getPref("getBoolPref", PREF_BLOCKLIST_SUPPRESSUI, false)) {
|
if (Services.prefs.getBoolPref(PREF_BLOCKLIST_SUPPRESSUI, false)) {
|
||||||
applyBlocklistChanges();
|
applyBlocklistChanges();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -234,7 +234,7 @@ var LOG = function() {};
|
||||||
|
|
||||||
if (AppConstants.DEBUG) {
|
if (AppConstants.DEBUG) {
|
||||||
LOG = function (aText) {
|
LOG = function (aText) {
|
||||||
if (getBoolPref(BROWSER_SEARCH_PREF + "log", false)) {
|
if (Services.prefs.getBoolPref(BROWSER_SEARCH_PREF + "log", false)) {
|
||||||
DO_LOG(aText);
|
DO_LOG(aText);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -907,18 +907,6 @@ function getLocalizedPref(aPrefName, aDefault) {
|
||||||
return aDefault;
|
return aDefault;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Wrapper for nsIPrefBranch::getBoolPref.
|
|
||||||
* @param aPrefName
|
|
||||||
* The name of the pref to get.
|
|
||||||
* @returns aDefault if the requested pref doesn't exist.
|
|
||||||
*/
|
|
||||||
function getBoolPref(aName, aDefault) {
|
|
||||||
if (Services.prefs.getPrefType(aName) != Ci.nsIPrefBranch.PREF_BOOL)
|
|
||||||
return aDefault;
|
|
||||||
return Services.prefs.getBoolPref(aName);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return a sanitized name to be used as a filename, or a random name
|
* @return a sanitized name to be used as a filename, or a random name
|
||||||
* if a sanitized name cannot be obtained (if aName contains
|
* if a sanitized name cannot be obtained (if aName contains
|
||||||
|
|
@ -1534,7 +1522,7 @@ Engine.prototype = {
|
||||||
stringBundle.formatStringFromName("addEngineConfirmation",
|
stringBundle.formatStringFromName("addEngineConfirmation",
|
||||||
[this._name, this._uri.host], 2);
|
[this._name, this._uri.host], 2);
|
||||||
var checkboxMessage = null;
|
var checkboxMessage = null;
|
||||||
if (!getBoolPref(BROWSER_SEARCH_PREF + "noCurrentEngine", false))
|
if (!Services.prefs.getBoolPref(BROWSER_SEARCH_PREF + "noCurrentEngine", false))
|
||||||
checkboxMessage = stringBundle.GetStringFromName("addEngineAsCurrentText");
|
checkboxMessage = stringBundle.GetStringFromName("addEngineAsCurrentText");
|
||||||
|
|
||||||
var addButtonLabel =
|
var addButtonLabel =
|
||||||
|
|
@ -2658,7 +2646,7 @@ function checkForSyncCompletion(aPromise) {
|
||||||
// nsIBrowserSearchService
|
// nsIBrowserSearchService
|
||||||
function SearchService() {
|
function SearchService() {
|
||||||
// Replace empty LOG function with the useful one if the log pref is set.
|
// Replace empty LOG function with the useful one if the log pref is set.
|
||||||
if (getBoolPref(BROWSER_SEARCH_PREF + "log", false))
|
if (Services.prefs.getBoolPref(BROWSER_SEARCH_PREF + "log", false))
|
||||||
LOG = DO_LOG;
|
LOG = DO_LOG;
|
||||||
|
|
||||||
this._initObservers = Promise.defer();
|
this._initObservers = Promise.defer();
|
||||||
|
|
@ -3770,7 +3758,7 @@ SearchService.prototype = {
|
||||||
|
|
||||||
// If the user has specified a custom engine order, read the order
|
// If the user has specified a custom engine order, read the order
|
||||||
// information from the metadata instead of the default prefs.
|
// information from the metadata instead of the default prefs.
|
||||||
if (getBoolPref(BROWSER_SEARCH_PREF + "useDBForOrder", false)) {
|
if (Services.prefs.getBoolPref(BROWSER_SEARCH_PREF + "useDBForOrder", false)) {
|
||||||
LOG("_buildSortedEngineList: using db for order");
|
LOG("_buildSortedEngineList: using db for order");
|
||||||
|
|
||||||
// Flag to keep track of whether or not we need to call _saveSortedEngineList.
|
// Flag to keep track of whether or not we need to call _saveSortedEngineList.
|
||||||
|
|
@ -4624,7 +4612,7 @@ SearchService.prototype = {
|
||||||
notify: function SRCH_SVC_notify(aTimer) {
|
notify: function SRCH_SVC_notify(aTimer) {
|
||||||
LOG("_notify: checking for updates");
|
LOG("_notify: checking for updates");
|
||||||
|
|
||||||
if (!getBoolPref(BROWSER_SEARCH_PREF + "update", true))
|
if (!Services.prefs.getBoolPref(BROWSER_SEARCH_PREF + "update", true))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Our timer has expired, but unfortunately, we can't get any data from it.
|
// Our timer has expired, but unfortunately, we can't get any data from it.
|
||||||
|
|
@ -4735,7 +4723,7 @@ const SEARCH_UPDATE_LOG_PREFIX = "*** Search update: ";
|
||||||
* logging pref (browser.search.update.log) is set to true.
|
* logging pref (browser.search.update.log) is set to true.
|
||||||
*/
|
*/
|
||||||
function ULOG(aText) {
|
function ULOG(aText) {
|
||||||
if (getBoolPref(BROWSER_SEARCH_PREF + "update.log", false)) {
|
if (Services.prefs.getBoolPref(BROWSER_SEARCH_PREF + "update.log", false)) {
|
||||||
dump(SEARCH_UPDATE_LOG_PREFIX + aText + "\n");
|
dump(SEARCH_UPDATE_LOG_PREFIX + aText + "\n");
|
||||||
Services.console.logStringMessage(aText);
|
Services.console.logStringMessage(aText);
|
||||||
}
|
}
|
||||||
|
|
@ -4751,7 +4739,7 @@ var engineUpdateService = {
|
||||||
update: function eus_Update(aEngine) {
|
update: function eus_Update(aEngine) {
|
||||||
let engine = aEngine.wrappedJSObject;
|
let engine = aEngine.wrappedJSObject;
|
||||||
ULOG("update called for " + aEngine._name);
|
ULOG("update called for " + aEngine._name);
|
||||||
if (!getBoolPref(BROWSER_SEARCH_PREF + "update", true) || !engine._hasUpdates)
|
if (!Services.prefs.getBoolPref(BROWSER_SEARCH_PREF + "update", true) || !engine._hasUpdates)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
let testEngine = null;
|
let testEngine = null;
|
||||||
|
|
|
||||||
|
|
@ -248,7 +248,7 @@ function DO_LOG(aText) {
|
||||||
* to allow enabling/disabling without a restart.
|
* to allow enabling/disabling without a restart.
|
||||||
*/
|
*/
|
||||||
function PREF_LOG(aText) {
|
function PREF_LOG(aText) {
|
||||||
if (getBoolPref(BROWSER_SEARCH_PREF + "log", false))
|
if (Services.prefs.getBoolPref(BROWSER_SEARCH_PREF + "log", false))
|
||||||
DO_LOG(aText);
|
DO_LOG(aText);
|
||||||
}
|
}
|
||||||
var LOG = PREF_LOG;
|
var LOG = PREF_LOG;
|
||||||
|
|
@ -933,18 +933,6 @@ function setLocalizedPref(aPrefName, aValue) {
|
||||||
} catch (ex) {}
|
} catch (ex) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Wrapper for nsIPrefBranch::getBoolPref.
|
|
||||||
* @param aPrefName
|
|
||||||
* The name of the pref to get.
|
|
||||||
* @returns aDefault if the requested pref doesn't exist.
|
|
||||||
*/
|
|
||||||
function getBoolPref(aName, aDefault) {
|
|
||||||
if (Services.prefs.getPrefType(aName) != Ci.nsIPrefBranch.PREF_BOOL)
|
|
||||||
return aDefault;
|
|
||||||
return Services.prefs.getBoolPref(aName);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a unique nsIFile object with a sanitized name, based on the engine name.
|
* Get a unique nsIFile object with a sanitized name, based on the engine name.
|
||||||
* @param aName
|
* @param aName
|
||||||
|
|
@ -1591,7 +1579,7 @@ Engine.prototype = {
|
||||||
stringBundle.formatStringFromName("addEngineConfirmation",
|
stringBundle.formatStringFromName("addEngineConfirmation",
|
||||||
[this._name, this._uri.host], 2);
|
[this._name, this._uri.host], 2);
|
||||||
var checkboxMessage = null;
|
var checkboxMessage = null;
|
||||||
if (!getBoolPref(BROWSER_SEARCH_PREF + "noCurrentEngine", false))
|
if (!Services.prefs.getBoolPref(BROWSER_SEARCH_PREF + "noCurrentEngine", false))
|
||||||
checkboxMessage = stringBundle.GetStringFromName("addEngineAsCurrentText");
|
checkboxMessage = stringBundle.GetStringFromName("addEngineAsCurrentText");
|
||||||
|
|
||||||
var addButtonLabel =
|
var addButtonLabel =
|
||||||
|
|
@ -2889,7 +2877,7 @@ function checkForSyncCompletion(aPromise) {
|
||||||
// nsIBrowserSearchService
|
// nsIBrowserSearchService
|
||||||
function SearchService() {
|
function SearchService() {
|
||||||
// Replace empty LOG function with the useful one if the log pref is set.
|
// Replace empty LOG function with the useful one if the log pref is set.
|
||||||
if (getBoolPref(BROWSER_SEARCH_PREF + "log", false))
|
if (Services.prefs.getBoolPref(BROWSER_SEARCH_PREF + "log", false))
|
||||||
LOG = DO_LOG;
|
LOG = DO_LOG;
|
||||||
|
|
||||||
this._initObservers = Promise.defer();
|
this._initObservers = Promise.defer();
|
||||||
|
|
@ -3814,7 +3802,7 @@ SearchService.prototype = {
|
||||||
// If the user has specified a custom engine order, read the order
|
// If the user has specified a custom engine order, read the order
|
||||||
// information from the engineMetadataService instead of the default
|
// information from the engineMetadataService instead of the default
|
||||||
// prefs.
|
// prefs.
|
||||||
if (getBoolPref(BROWSER_SEARCH_PREF + "useDBForOrder", false)) {
|
if (Services.prefs.getBoolPref(BROWSER_SEARCH_PREF + "useDBForOrder", false)) {
|
||||||
LOG("_buildSortedEngineList: using db for order");
|
LOG("_buildSortedEngineList: using db for order");
|
||||||
|
|
||||||
// Flag to keep track of whether or not we need to call _saveSortedEngineList.
|
// Flag to keep track of whether or not we need to call _saveSortedEngineList.
|
||||||
|
|
@ -4595,7 +4583,7 @@ SearchService.prototype = {
|
||||||
notify: function SRCH_SVC_notify(aTimer) {
|
notify: function SRCH_SVC_notify(aTimer) {
|
||||||
LOG("_notify: checking for updates");
|
LOG("_notify: checking for updates");
|
||||||
|
|
||||||
if (!getBoolPref(BROWSER_SEARCH_PREF + "update", true))
|
if (!Services.prefs.getBoolPref(BROWSER_SEARCH_PREF + "update", true))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Our timer has expired, but unfortunately, we can't get any data from it.
|
// Our timer has expired, but unfortunately, we can't get any data from it.
|
||||||
|
|
@ -4938,7 +4926,7 @@ const SEARCH_UPDATE_LOG_PREFIX = "*** Search update: ";
|
||||||
* logging pref (browser.search.update.log) is set to true.
|
* logging pref (browser.search.update.log) is set to true.
|
||||||
*/
|
*/
|
||||||
function ULOG(aText) {
|
function ULOG(aText) {
|
||||||
if (getBoolPref(BROWSER_SEARCH_PREF + "update.log", false)) {
|
if (Services.prefs.getBoolPref(BROWSER_SEARCH_PREF + "update.log", false)) {
|
||||||
dump(SEARCH_UPDATE_LOG_PREFIX + aText + "\n");
|
dump(SEARCH_UPDATE_LOG_PREFIX + aText + "\n");
|
||||||
Services.console.logStringMessage(aText);
|
Services.console.logStringMessage(aText);
|
||||||
}
|
}
|
||||||
|
|
@ -4955,7 +4943,7 @@ var engineUpdateService = {
|
||||||
update: function eus_Update(aEngine) {
|
update: function eus_Update(aEngine) {
|
||||||
let engine = aEngine.wrappedJSObject;
|
let engine = aEngine.wrappedJSObject;
|
||||||
ULOG("update called for " + aEngine._name);
|
ULOG("update called for " + aEngine._name);
|
||||||
if (!getBoolPref(BROWSER_SEARCH_PREF + "update", true) || !engine._hasUpdates)
|
if (!Services.prefs.getBoolPref(BROWSER_SEARCH_PREF + "update", true) || !engine._hasUpdates)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
let testEngine = null;
|
let testEngine = null;
|
||||||
|
|
|
||||||
|
|
@ -16,29 +16,9 @@ const PREF_APP_UPDATE_LOG = "app.update.log";
|
||||||
const CATEGORY_UPDATE_TIMER = "update-timer";
|
const CATEGORY_UPDATE_TIMER = "update-timer";
|
||||||
|
|
||||||
XPCOMUtils.defineLazyGetter(this, "gLogEnabled", function tm_gLogEnabled() {
|
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.
|
* Logs a string to the error console.
|
||||||
* @param string
|
* @param string
|
||||||
|
|
@ -93,13 +73,13 @@ TimerManager.prototype = {
|
||||||
minInterval = 500;
|
minInterval = 500;
|
||||||
minFirstInterval = 500;
|
minFirstInterval = 500;
|
||||||
case "profile-after-change":
|
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);
|
minInterval);
|
||||||
// Prevent the timer delay between notifications to other consumers from
|
// Prevent the timer delay between notifications to other consumers from
|
||||||
// being greater than 5 minutes which is 300000 milliseconds.
|
// being greater than 5 minutes which is 300000 milliseconds.
|
||||||
this._timerMinimumDelay = Math.min(this._timerMinimumDelay, 300000);
|
this._timerMinimumDelay = Math.min(this._timerMinimumDelay, 300000);
|
||||||
// Prevent the first interval from being less than the value of minFirstInterval
|
// 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);
|
30000), minFirstInterval);
|
||||||
// Prevent the first interval from being greater than 2 minutes which is
|
// Prevent the first interval from being greater than 2 minutes which is
|
||||||
// 120000 milliseconds.
|
// 120000 milliseconds.
|
||||||
|
|
@ -189,7 +169,7 @@ TimerManager.prototype = {
|
||||||
continue;
|
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
|
// Allow the update-timer category to specify a maximum value to prevent
|
||||||
// values larger than desired.
|
// values larger than desired.
|
||||||
maxInterval = parseInt(maxInterval);
|
maxInterval = parseInt(maxInterval);
|
||||||
|
|
@ -200,7 +180,7 @@ TimerManager.prototype = {
|
||||||
timerID);
|
timerID);
|
||||||
// Initialize the last update time to 0 when the preference isn't set so
|
// 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.
|
// 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
|
// 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
|
// 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);
|
let prefLastUpdate = PREF_APP_UPDATE_LASTUPDATETIME_FMT.replace(/%ID%/, id);
|
||||||
// Initialize the last update time to 0 when the preference isn't set so
|
// 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.
|
// 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);
|
let now = Math.round(Date.now() / 1000);
|
||||||
if (lastUpdateTime > now) {
|
if (lastUpdateTime > now) {
|
||||||
lastUpdateTime = 0;
|
lastUpdateTime = 0;
|
||||||
|
|
|
||||||
|
|
@ -84,28 +84,6 @@ function openUpdateURL(event) {
|
||||||
openURL(event.target.getAttribute("url"));
|
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.
|
* A set of shared data and control functions for the wizard as a whole.
|
||||||
*/
|
*/
|
||||||
|
|
@ -320,7 +298,7 @@ var gUpdates = {
|
||||||
onLoad: function() {
|
onLoad: function() {
|
||||||
this.wiz = document.documentElement;
|
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");
|
this.strings = document.getElementById("updateStrings");
|
||||||
var brandStrings = document.getElementById("brandStrings");
|
var brandStrings = document.getElementById("brandStrings");
|
||||||
|
|
@ -601,7 +579,7 @@ var gNoUpdatesPage = {
|
||||||
LOG("gNoUpdatesPage", "onPageShow - could not select an appropriate " +
|
LOG("gNoUpdatesPage", "onPageShow - could not select an appropriate " +
|
||||||
"update. Either there were no updates or |selectUpdate| failed");
|
"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;
|
document.getElementById("noUpdatesAutoEnabled").hidden = false;
|
||||||
else
|
else
|
||||||
document.getElementById("noUpdatesAutoDisabled").hidden = false;
|
document.getElementById("noUpdatesAutoDisabled").hidden = false;
|
||||||
|
|
@ -1309,7 +1287,7 @@ var gFinishedPage = {
|
||||||
moreElevatedLinkLabel.setAttribute("hidden", "false");
|
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(); },
|
setTimeout(function () { gUpdates.wiz.getButton("finish").click(); },
|
||||||
UPDATE_TEST_LOOP_INTERVAL);
|
UPDATE_TEST_LOOP_INTERVAL);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -164,7 +164,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "UpdateUtils",
|
||||||
"resource://gre/modules/UpdateUtils.jsm");
|
"resource://gre/modules/UpdateUtils.jsm");
|
||||||
|
|
||||||
XPCOMUtils.defineLazyGetter(this, "gLogEnabled", function aus_gLogEnabled() {
|
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() {
|
XPCOMUtils.defineLazyGetter(this, "gUpdateBundle", function aus_gUpdateBundle() {
|
||||||
|
|
@ -494,7 +494,7 @@ XPCOMUtils.defineLazyGetter(this, "gCanStageUpdatesSession", function aus_gCSUS(
|
||||||
*/
|
*/
|
||||||
function getCanStageUpdates() {
|
function getCanStageUpdates() {
|
||||||
// If staging updates are disabled, then just bail out!
|
// 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 " +
|
LOG("getCanStageUpdates - staging updates is disabled by preference " +
|
||||||
PREF_APP_UPDATE_STAGING_ENABLED);
|
PREF_APP_UPDATE_STAGING_ENABLED);
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -514,7 +514,7 @@ XPCOMUtils.defineLazyGetter(this, "gCanCheckForUpdates", function aus_gCanCheckF
|
||||||
// If the administrator has disabled app update and locked the preference so
|
// 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
|
// 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.
|
// 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)) {
|
if (!enabled && Services.prefs.prefIsLocked(PREF_APP_UPDATE_ENABLED)) {
|
||||||
LOG("gCanCheckForUpdates - unable to automatically check for updates, " +
|
LOG("gCanCheckForUpdates - unable to automatically check for updates, " +
|
||||||
"the preference is disabled and admistratively locked.");
|
"the preference is disabled and admistratively locked.");
|
||||||
|
|
@ -550,27 +550,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.
|
* Convert a string containing binary values to hex.
|
||||||
*/
|
*/
|
||||||
|
|
@ -898,16 +877,15 @@ function handleUpdateFailure(update, errorCode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (update.errorCode == ELEVATION_CANCELED) {
|
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++;
|
cancelations++;
|
||||||
Services.prefs.setIntPref(PREF_APP_UPDATE_CANCELATIONS, cancelations);
|
Services.prefs.setIntPref(PREF_APP_UPDATE_CANCELATIONS, cancelations);
|
||||||
if (AppConstants.platform == "macosx") {
|
if (AppConstants.platform == "macosx") {
|
||||||
let osxCancelations = getPref("getIntPref",
|
let osxCancelations = Services.prefs.getIntPref(PREF_APP_UPDATE_CANCELATIONS_OSX, 0);
|
||||||
PREF_APP_UPDATE_CANCELATIONS_OSX, 0);
|
|
||||||
osxCancelations++;
|
osxCancelations++;
|
||||||
Services.prefs.setIntPref(PREF_APP_UPDATE_CANCELATIONS_OSX,
|
Services.prefs.setIntPref(PREF_APP_UPDATE_CANCELATIONS_OSX,
|
||||||
osxCancelations);
|
osxCancelations);
|
||||||
let maxCancels = getPref("getIntPref",
|
let maxCancels = Services.prefs.getIntPref(
|
||||||
PREF_APP_UPDATE_CANCELATIONS_OSX_MAX,
|
PREF_APP_UPDATE_CANCELATIONS_OSX_MAX,
|
||||||
DEFAULT_CANCELATIONS_OSX_MAX);
|
DEFAULT_CANCELATIONS_OSX_MAX);
|
||||||
// Prevent the preference from setting a value greater than 5.
|
// Prevent the preference from setting a value greater than 5.
|
||||||
|
|
@ -1177,8 +1155,8 @@ function Update(update) {
|
||||||
this.showNeverForVersion = false;
|
this.showNeverForVersion = false;
|
||||||
this.unsupported = false;
|
this.unsupported = false;
|
||||||
this.channel = "default";
|
this.channel = "default";
|
||||||
this.promptWaitTime = getPref("getIntPref", PREF_APP_UPDATE_PROMPTWAITTIME, 43200);
|
this.promptWaitTime = Services.prefs.getIntPref(PREF_APP_UPDATE_PROMPTWAITTIME, 43200);
|
||||||
this.backgroundInterval = getPref("getIntPref", PREF_APP_UPDATE_BACKGROUNDINTERVAL,
|
this.backgroundInterval = Services.prefs.getIntPref(PREF_APP_UPDATE_BACKGROUNDINTERVAL,
|
||||||
DOWNLOAD_BACKGROUND_INTERVAL);
|
DOWNLOAD_BACKGROUND_INTERVAL);
|
||||||
|
|
||||||
// Null <update>, assume this is a message container and do no
|
// Null <update>, assume this is a message container and do no
|
||||||
|
|
@ -1558,7 +1536,7 @@ UpdateService.prototype = {
|
||||||
break;
|
break;
|
||||||
case "nsPref:changed":
|
case "nsPref:changed":
|
||||||
if (data == PREF_APP_UPDATE_LOG) {
|
if (data == PREF_APP_UPDATE_LOG) {
|
||||||
gLogEnabled = getPref("getBoolPref", PREF_APP_UPDATE_LOG, false);
|
gLogEnabled = Services.prefs.getBoolPref(PREF_APP_UPDATE_LOG, false);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "profile-change-net-teardown": // fall thru
|
case "profile-change-net-teardown": // fall thru
|
||||||
|
|
@ -1795,11 +1773,11 @@ UpdateService.prototype = {
|
||||||
// Send the error code to telemetry
|
// Send the error code to telemetry
|
||||||
AUSTLMY.pingCheckExError(this._pingSuffix, update.errorCode);
|
AUSTLMY.pingCheckExError(this._pingSuffix, update.errorCode);
|
||||||
update.errorCode = BACKGROUNDCHECK_MULTIPLE_FAILURES;
|
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++;
|
errCount++;
|
||||||
Services.prefs.setIntPref(PREF_APP_UPDATE_BACKGROUNDERRORS, errCount);
|
Services.prefs.setIntPref(PREF_APP_UPDATE_BACKGROUNDERRORS, errCount);
|
||||||
// Don't allow the preference to set a value greater than 20 for max errors.
|
// 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) {
|
if (errCount >= maxErrors) {
|
||||||
let prompter = Cc["@mozilla.org/updates/update-prompt;1"].
|
let prompter = Cc["@mozilla.org/updates/update-prompt;1"].
|
||||||
|
|
@ -1969,7 +1947,7 @@ UpdateService.prototype = {
|
||||||
AUSTLMY.pingCheckCode(this._pingSuffix,
|
AUSTLMY.pingCheckCode(this._pingSuffix,
|
||||||
AUSTLMY.CHK_INVALID_DEFAULT_URL);
|
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);
|
AUSTLMY.pingCheckCode(this._pingSuffix, AUSTLMY.CHK_PREF_DISABLED);
|
||||||
} else if (!hasUpdateMutex()) {
|
} else if (!hasUpdateMutex()) {
|
||||||
AUSTLMY.pingCheckCode(this._pingSuffix, AUSTLMY.CHK_NO_MUTEX);
|
AUSTLMY.pingCheckCode(this._pingSuffix, AUSTLMY.CHK_NO_MUTEX);
|
||||||
|
|
@ -2027,7 +2005,7 @@ UpdateService.prototype = {
|
||||||
// (see bug 350636).
|
// (see bug 350636).
|
||||||
let neverPrefName = PREFBRANCH_APP_UPDATE_NEVER + aUpdate.appVersion;
|
let neverPrefName = PREFBRANCH_APP_UPDATE_NEVER + aUpdate.appVersion;
|
||||||
if (aUpdate.showNeverForVersion &&
|
if (aUpdate.showNeverForVersion &&
|
||||||
getPref("getBoolPref", neverPrefName, false)) {
|
Services.prefs.getBoolPref(neverPrefName, false)) {
|
||||||
LOG("UpdateService:selectUpdate - skipping update because the " +
|
LOG("UpdateService:selectUpdate - skipping update because the " +
|
||||||
"preference " + neverPrefName + " is true");
|
"preference " + neverPrefName + " is true");
|
||||||
lastCheckCode = AUSTLMY.CHK_UPDATE_NEVER_PREF;
|
lastCheckCode = AUSTLMY.CHK_UPDATE_NEVER_PREF;
|
||||||
|
|
@ -2058,7 +2036,7 @@ UpdateService.prototype = {
|
||||||
let update = minorUpdate || majorUpdate;
|
let update = minorUpdate || majorUpdate;
|
||||||
if (AppConstants.platform == "macosx" && update) {
|
if (AppConstants.platform == "macosx" && update) {
|
||||||
if (getElevationRequired()) {
|
if (getElevationRequired()) {
|
||||||
let installAttemptVersion = getPref("getCharPref",
|
let installAttemptVersion = Services.prefs.getCharPref(
|
||||||
PREF_APP_UPDATE_ELEVATE_VERSION,
|
PREF_APP_UPDATE_ELEVATE_VERSION,
|
||||||
null);
|
null);
|
||||||
if (vc.compare(installAttemptVersion, update.appVersion) != 0) {
|
if (vc.compare(installAttemptVersion, update.appVersion) != 0) {
|
||||||
|
|
@ -2072,12 +2050,9 @@ UpdateService.prototype = {
|
||||||
Services.prefs.clearUserPref(PREF_APP_UPDATE_ELEVATE_NEVER);
|
Services.prefs.clearUserPref(PREF_APP_UPDATE_ELEVATE_NEVER);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let numCancels = getPref("getIntPref",
|
let numCancels = Services.prefs.getIntPref(PREF_APP_UPDATE_CANCELATIONS_OSX, 0);
|
||||||
PREF_APP_UPDATE_CANCELATIONS_OSX, 0);
|
let rejectedVersion = Services.prefs.getCharPref(PREF_APP_UPDATE_ELEVATE_NEVER, "");
|
||||||
let rejectedVersion = getPref("getCharPref",
|
let maxCancels = Services.prefs.getIntPref(PREF_APP_UPDATE_CANCELATIONS_OSX_MAX,
|
||||||
PREF_APP_UPDATE_ELEVATE_NEVER, "");
|
|
||||||
let maxCancels = getPref("getIntPref",
|
|
||||||
PREF_APP_UPDATE_CANCELATIONS_OSX_MAX,
|
|
||||||
DEFAULT_CANCELATIONS_OSX_MAX);
|
DEFAULT_CANCELATIONS_OSX_MAX);
|
||||||
if (numCancels >= maxCancels) {
|
if (numCancels >= maxCancels) {
|
||||||
LOG("UpdateService:selectUpdate - the user requires elevation to " +
|
LOG("UpdateService:selectUpdate - the user requires elevation to " +
|
||||||
|
|
@ -2136,7 +2111,7 @@ UpdateService.prototype = {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var updateEnabled = getPref("getBoolPref", PREF_APP_UPDATE_ENABLED, true);
|
var updateEnabled = Services.prefs.getBoolPref(PREF_APP_UPDATE_ENABLED, true);
|
||||||
if (!updateEnabled) {
|
if (!updateEnabled) {
|
||||||
AUSTLMY.pingCheckCode(this._pingSuffix, AUSTLMY.CHK_PREF_DISABLED);
|
AUSTLMY.pingCheckCode(this._pingSuffix, AUSTLMY.CHK_PREF_DISABLED);
|
||||||
LOG("UpdateService:_selectAndInstallUpdate - not prompting because " +
|
LOG("UpdateService:_selectAndInstallUpdate - not prompting because " +
|
||||||
|
|
@ -2152,7 +2127,7 @@ UpdateService.prototype = {
|
||||||
if (update.unsupported) {
|
if (update.unsupported) {
|
||||||
LOG("UpdateService:_selectAndInstallUpdate - update not supported for " +
|
LOG("UpdateService:_selectAndInstallUpdate - update not supported for " +
|
||||||
"this system");
|
"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 " +
|
LOG("UpdateService:_selectAndInstallUpdate - notifying that the " +
|
||||||
"update is not supported for this system");
|
"update is not supported for this system");
|
||||||
this._showPrompt(update);
|
this._showPrompt(update);
|
||||||
|
|
@ -2193,7 +2168,7 @@ UpdateService.prototype = {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!getPref("getBoolPref", PREF_APP_UPDATE_AUTO, true)) {
|
if (!Services.prefs.getBoolPref(PREF_APP_UPDATE_AUTO, true)) {
|
||||||
LOG("UpdateService:_selectAndInstallUpdate - prompting because silent " +
|
LOG("UpdateService:_selectAndInstallUpdate - prompting because silent " +
|
||||||
"install is disabled");
|
"install is disabled");
|
||||||
AUSTLMY.pingCheckCode(this._pingSuffix, AUSTLMY.CHK_SHOWPROMPT_PREF);
|
AUSTLMY.pingCheckCode(this._pingSuffix, AUSTLMY.CHK_SHOWPROMPT_PREF);
|
||||||
|
|
@ -2733,7 +2708,7 @@ UpdateManager.prototype = {
|
||||||
Services.obs.notifyObservers(null, "update-staged", update.state);
|
Services.obs.notifyObservers(null, "update-staged", update.state);
|
||||||
|
|
||||||
// Only prompt when the UI isn't already open.
|
// 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) ||
|
if (Services.wm.getMostRecentWindow(UPDATE_WINDOW_NAME) ||
|
||||||
windowType && Services.wm.getMostRecentWindow(windowType)) {
|
windowType && Services.wm.getMostRecentWindow(windowType)) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -2813,7 +2788,7 @@ Checker.prototype = {
|
||||||
this._forced = force;
|
this._forced = force;
|
||||||
|
|
||||||
// Use the override URL if specified.
|
// Use the override URL if specified.
|
||||||
let url = getPref("getCharPref", PREF_APP_UPDATE_URL_OVERRIDE, null);
|
let url = Services.prefs.getCharPref(PREF_APP_UPDATE_URL_OVERRIDE, null);
|
||||||
|
|
||||||
// Otherwise, construct the update URL from component parts.
|
// Otherwise, construct the update URL from component parts.
|
||||||
if (!url) {
|
if (!url) {
|
||||||
|
|
@ -3016,7 +2991,7 @@ Checker.prototype = {
|
||||||
*/
|
*/
|
||||||
_enabled: true,
|
_enabled: true,
|
||||||
get enabled() {
|
get enabled() {
|
||||||
return getPref("getBoolPref", PREF_APP_UPDATE_ENABLED, true) &&
|
return Services.prefs.getBoolPref(PREF_APP_UPDATE_ENABLED, true) &&
|
||||||
gCanCheckForUpdates && hasUpdateMutex() && this._enabled;
|
gCanCheckForUpdates && hasUpdateMutex() && this._enabled;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -3502,11 +3477,11 @@ Downloader.prototype = {
|
||||||
var shouldRegisterOnlineObserver = false;
|
var shouldRegisterOnlineObserver = false;
|
||||||
var shouldRetrySoon = false;
|
var shouldRetrySoon = false;
|
||||||
var deleteActiveUpdate = 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);
|
DEFAULT_SOCKET_RETRYTIMEOUT);
|
||||||
// Prevent the preference from setting a value greater than 10000.
|
// Prevent the preference from setting a value greater than 10000.
|
||||||
retryTimeout = Math.min(retryTimeout, 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);
|
DEFAULT_SOCKET_MAX_ERRORS);
|
||||||
// Prevent the preference from setting a value greater than 20.
|
// Prevent the preference from setting a value greater than 20.
|
||||||
maxFail = Math.min(maxFail, 20);
|
maxFail = Math.min(maxFail, 20);
|
||||||
|
|
@ -3762,7 +3737,7 @@ UpdatePrompt.prototype = {
|
||||||
* See nsIUpdateService.idl
|
* See nsIUpdateService.idl
|
||||||
*/
|
*/
|
||||||
showUpdateAvailable: function UP_showUpdateAvailable(update) {
|
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()) {
|
this._getUpdateWindow() || this._getAltUpdateWindow()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -3775,7 +3750,7 @@ UpdatePrompt.prototype = {
|
||||||
* See nsIUpdateService.idl
|
* See nsIUpdateService.idl
|
||||||
*/
|
*/
|
||||||
showUpdateDownloaded: function UP_showUpdateDownloaded(update, background) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
// Trigger the display of the hamburger menu badge.
|
// Trigger the display of the hamburger menu badge.
|
||||||
|
|
@ -3797,7 +3772,7 @@ UpdatePrompt.prototype = {
|
||||||
* See nsIUpdateService.idl
|
* See nsIUpdateService.idl
|
||||||
*/
|
*/
|
||||||
showUpdateError: function UP_showUpdateError(update) {
|
showUpdateError: function UP_showUpdateError(update) {
|
||||||
if (getPref("getBoolPref", PREF_APP_UPDATE_SILENT, false) ||
|
if (Services.prefs.getBoolPref(PREF_APP_UPDATE_SILENT, false) ||
|
||||||
this._getAltUpdateWindow())
|
this._getAltUpdateWindow())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -3840,7 +3815,7 @@ UpdatePrompt.prototype = {
|
||||||
* See nsIUpdateService.idl
|
* See nsIUpdateService.idl
|
||||||
*/
|
*/
|
||||||
showUpdateElevationRequired: function UP_showUpdateElevationRequired() {
|
showUpdateElevationRequired: function UP_showUpdateElevationRequired() {
|
||||||
if (getPref("getBoolPref", PREF_APP_UPDATE_SILENT, false) ||
|
if (Services.prefs.getBoolPref(PREF_APP_UPDATE_SILENT, false) ||
|
||||||
this._getAltUpdateWindow()) {
|
this._getAltUpdateWindow()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -3864,7 +3839,7 @@ UpdatePrompt.prototype = {
|
||||||
* application update user interface window.
|
* application update user interface window.
|
||||||
*/
|
*/
|
||||||
_getAltUpdateWindow: function UP__getAltUpdateWindow() {
|
_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)
|
if (!windowType)
|
||||||
return null;
|
return null;
|
||||||
return Services.wm.getMostRecentWindow(windowType);
|
return Services.wm.getMostRecentWindow(windowType);
|
||||||
|
|
@ -3916,7 +3891,7 @@ UpdatePrompt.prototype = {
|
||||||
var idleService = Cc["@mozilla.org/widget/idleservice;1"].
|
var idleService = Cc["@mozilla.org/widget/idleservice;1"].
|
||||||
getService(Ci.nsIIdleService);
|
getService(Ci.nsIIdleService);
|
||||||
// Don't allow the preference to set a value greater than 600 seconds for the idle time.
|
// 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) {
|
if (idleService.idleTime / 1000 >= IDLE_TIME) {
|
||||||
this._showUI(parent, uri, features, name, page, update);
|
this._showUI(parent, uri, features, name, page, update);
|
||||||
return;
|
return;
|
||||||
|
|
@ -3961,7 +3936,7 @@ UpdatePrompt.prototype = {
|
||||||
getService(Ci.nsIIdleService);
|
getService(Ci.nsIIdleService);
|
||||||
|
|
||||||
// Don't allow the preference to set a value greater than 600 seconds for the idle time.
|
// 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) {
|
if (idleService.idleTime / 1000 >= IDLE_TIME) {
|
||||||
this._showUI(parent, uri, features, name, page, update);
|
this._showUI(parent, uri, features, name, page, update);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue