Index: lib/prefs.js |
=================================================================== |
--- a/lib/prefs.js |
+++ b/lib/prefs.js |
@@ -39,17 +39,20 @@ function init() |
setter(defaultBranch, pref, value); |
defineProperty(pref, false, getter, setter); |
} |
// Add preference change observer |
try |
{ |
branch.QueryInterface(Ci.nsIPrefBranch2).addObserver("", Prefs, true); |
- onShutdown.add(function() branch.removeObserver("", Prefs)); |
+ onShutdown.add(function() |
+ { |
+ branch.removeObserver("", Prefs); |
+ }); |
Wladimir Palant
2015/11/05 11:25:16
I'd really prefer an arrow function here instead o
|
} |
catch (e) |
{ |
Cu.reportError(e); |
} |
} |
/** |
@@ -65,17 +68,20 @@ function defineProperty(/**String*/ name |
value = readFunc(branch, name); |
triggerListeners(name); |
} |
catch(e) |
{ |
Cu.reportError(e); |
} |
}; |
- Prefs.__defineGetter__(name, function() value); |
+ Prefs.__defineGetter__(name, function() |
+ { |
+ return value; |
+ }); |
Wladimir Palant
2015/11/05 11:25:16
Same here, I'd rather have this changed into an ar
|
Prefs.__defineSetter__(name, function(newValue) |
{ |
if (value == newValue) |
return value; |
try |
{ |
ignorePrefChanges = true; |
@@ -173,26 +179,47 @@ let Prefs = exports.Prefs = |
let typeMap = |
{ |
boolean: [getBoolPref, setBoolPref], |
number: [getIntPref, setIntPref], |
string: [getCharPref, setCharPref], |
object: [getJSONPref, setJSONPref] |
}; |
-function getIntPref(branch, pref) branch.getIntPref(pref) |
-function setIntPref(branch, pref, newValue) branch.setIntPref(pref, newValue) |
+function getIntPref(branch, pref) |
+{ |
+ return branch.getIntPref(pref); |
+} |
+function setIntPref(branch, pref, newValue) |
+{ |
+ branch.setIntPref(pref, newValue); |
+} |
-function getBoolPref(branch, pref) branch.getBoolPref(pref) |
-function setBoolPref(branch, pref, newValue) branch.setBoolPref(pref, newValue) |
+function getBoolPref(branch, pref) |
+{ |
+ return branch.getBoolPref(pref); |
+} |
+function setBoolPref(branch, pref, newValue) |
+{ |
+ branch.setBoolPref(pref, newValue); |
+} |
-function getCharPref(branch, pref) branch.getComplexValue(pref, Ci.nsISupportsString).data |
+function getCharPref(branch, pref) |
+{ |
+ return branch.getComplexValue(pref, Ci.nsISupportsString).data; |
+} |
function setCharPref(branch, pref, newValue) |
{ |
let str = Cc["@mozilla.org/supports-string;1"].createInstance(Ci.nsISupportsString); |
str.data = newValue; |
branch.setComplexValue(pref, Ci.nsISupportsString, str); |
} |
-function getJSONPref(branch, pref) JSON.parse(getCharPref(branch, pref)) |
-function setJSONPref(branch, pref, newValue) setCharPref(branch, pref, JSON.stringify(newValue)) |
+function getJSONPref(branch, pref) |
+{ |
+ return JSON.parse(getCharPref(branch, pref)); |
+} |
+function setJSONPref(branch, pref, newValue) |
+{ |
+ setCharPref(branch, pref, JSON.stringify(newValue)) |
+} |
init(); |