summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
authorAscrod <32915892+Ascrod@users.noreply.github.com>2019-03-24 20:22:03 -0400
committerAscrod <32915892+Ascrod@users.noreply.github.com>2019-03-24 20:22:03 -0400
commitc9d2e9bcfb77657b3be7d368e57f43747c23ddc4 (patch)
tree0956b0a08cd9b742821205535942913835ec97bc /application
parentcac3f9678de46298a93537e8913912bba28d89f7 (diff)
downloadUXP-c9d2e9bcfb77657b3be7d368e57f43747c23ddc4.tar
UXP-c9d2e9bcfb77657b3be7d368e57f43747c23ddc4.tar.gz
UXP-c9d2e9bcfb77657b3be7d368e57f43747c23ddc4.tar.lz
UXP-c9d2e9bcfb77657b3be7d368e57f43747c23ddc4.tar.xz
UXP-c9d2e9bcfb77657b3be7d368e57f43747c23ddc4.zip
Remove obsolete getPref helpers.
Diffstat (limited to 'application')
-rw-r--r--application/basilisk/base/content/browser.js4
-rw-r--r--application/basilisk/base/content/utilityOverlay.js20
-rw-r--r--application/basilisk/extensions/pdfjs/content/PdfJs.jsm23
-rw-r--r--application/basilisk/extensions/pdfjs/content/PdfStreamConverter.jsm38
-rw-r--r--application/palemoon/base/content/browser-menudragging.js26
-rw-r--r--application/palemoon/base/content/browser.js8
-rw-r--r--application/palemoon/base/content/utilityOverlay.js22
7 files changed, 33 insertions, 108 deletions
diff --git a/application/basilisk/base/content/browser.js b/application/basilisk/base/content/browser.js
index 336670fa0..e3a5393a0 100644
--- a/application/basilisk/base/content/browser.js
+++ b/application/basilisk/base/content/browser.js
@@ -1277,7 +1277,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 = {};
@@ -1868,7 +1868,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":
diff --git a/application/basilisk/base/content/utilityOverlay.js b/application/basilisk/base/content/utilityOverlay.js
index 38ca82f55..c576aef9e 100644
--- a/application/basilisk/base/content/utilityOverlay.js
+++ b/application/basilisk/base/content/utilityOverlay.js
@@ -61,16 +61,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
@@ -137,7 +127,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 +135,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))
@@ -342,7 +332,7 @@ function openLinkIn(url, where, params) {
if (loadInBackground == null) {
loadInBackground = aFromChrome ?
false :
- getBoolPref("browser.tabs.loadInBackground");
+ Services.prefs.getBoolPref("browser.tabs.loadInBackground");
}
let uriObj;
@@ -652,7 +642,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>
@@ -914,7 +904,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);
diff --git a/application/basilisk/extensions/pdfjs/content/PdfJs.jsm b/application/basilisk/extensions/pdfjs/content/PdfJs.jsm
index b3d85436e..7dc01c398 100644
--- a/application/basilisk/extensions/pdfjs/content/PdfJs.jsm
+++ b/application/basilisk/extensions/pdfjs/content/PdfJs.jsm
@@ -52,23 +52,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;
}
diff --git a/application/basilisk/extensions/pdfjs/content/PdfStreamConverter.jsm b/application/basilisk/extensions/pdfjs/content/PdfStreamConverter.jsm
index 5e337bbc5..b5b21f214 100644
--- a/application/basilisk/extensions/pdfjs/content/PdfStreamConverter.jsm
+++ b/application/basilisk/extensions/pdfjs/content/PdfStreamConverter.jsm
@@ -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) {
try {
return Services.prefs.getComplexValue(pref, Ci.nsISupportsString).data;
@@ -103,7 +87,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);
@@ -359,17 +343,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) {
@@ -531,10 +515,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);
@@ -921,16 +905,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);
}
diff --git a/application/palemoon/base/content/browser-menudragging.js b/application/palemoon/base/content/browser-menudragging.js
index cf26b2ba4..f3f00d72c 100644
--- a/application/palemoon/base/content/browser-menudragging.js
+++ b/application/palemoon/base/content/browser-menudragging.js
@@ -52,11 +52,9 @@ var browserMenuDragging = {
initPref: function(){
this.STAY_OPEN_ONDRAGEXIT =
- this.getPref('browser.menu.dragging.stayOpen',
- 'bool', false);
+ Services.prefs.getBoolPref('browser.menu.dragging.stayOpen', false);
this.DEBUG =
- this.getPref('browser.menu.dragging.debug',
- 'bool', false);
+ Services.prefs.getBoolPref('browser.menu.dragging.debug', false);
},
//delayed startup
@@ -291,26 +289,6 @@ var browserMenuDragging = {
.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){
var xpPref = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefService);
diff --git a/application/palemoon/base/content/browser.js b/application/palemoon/base/content/browser.js
index 4e753d422..1e7129272 100644
--- a/application/palemoon/base/content/browser.js
+++ b/application/palemoon/base/content/browser.js
@@ -1147,7 +1147,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();
// Initialize the full zoom setting.
@@ -1783,7 +1783,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":
@@ -3402,7 +3402,7 @@ function BrowserCustomizeToolbar() {
TabsInTitlebar.allowedBy("customizing-toolbars", false);
var customizeURL = "chrome://global/content/customizeToolbar.xul";
- gCustomizeSheet = getBoolPref("toolbar.customization.usesheet", false);
+ gCustomizeSheet = Services.prefs.getBoolPref("toolbar.customization.usesheet", false);
if (gCustomizeSheet) {
let sheetFrame = document.createElement("iframe");
@@ -3486,7 +3486,7 @@ function BrowserToolboxCustomizeDone(aToolboxChanged) {
cmd.removeAttribute("disabled");
// 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();
gBrowser.selectedBrowser.focus();
diff --git a/application/palemoon/base/content/utilityOverlay.js b/application/palemoon/base/content/utilityOverlay.js
index fe148ad04..c2a8baeed 100644
--- a/application/palemoon/base/content/utilityOverlay.js
+++ b/application/palemoon/base/content/utilityOverlay.js
@@ -75,16 +75,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
@@ -151,7 +141,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.
@@ -162,7 +152,7 @@ function whereToOpenLink( e, ignoreButton, ignoreAlt )
#endif
return shift ? "tabshifted" : "tab";
- if (alt && getBoolPref("browser.altClickSave", false))
+ if (alt && Services.prefs.getBoolPref("browser.altClickSave", false))
return "save";
if (shift || (middle && !middleUsesTabs))
@@ -334,7 +324,7 @@ function openLinkIn(url, where, params) {
if (loadInBackground == null) {
loadInBackground = aFromChrome ?
false :
- getBoolPref("browser.tabs.loadInBackground");
+ Services.prefs.getBoolPref("browser.tabs.loadInBackground");
}
let uriObj;
@@ -515,7 +505,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;
// 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)
{
- 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 win = Services.wm.getMostRecentWindow("Browser:Preferences");
@@ -854,7 +844,7 @@ function openHelpLink(aHelpTopic, aCalledFromModal) {
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);