Index: lib/prefs.js |
=================================================================== |
--- a/lib/prefs.js |
+++ b/lib/prefs.js |
@@ -44,7 +44,7 @@ |
try |
{ |
branch.QueryInterface(Ci.nsIPrefBranch2).addObserver("", Prefs, true); |
- onShutdown.add(function() branch.removeObserver("", Prefs)); |
+ onShutdown.add(() => branch.removeObserver("", Prefs)); |
} |
catch (e) |
{ |
@@ -70,29 +70,32 @@ |
Cu.reportError(e); |
} |
}; |
- Prefs.__defineGetter__(name, function() value); |
- Prefs.__defineSetter__(name, function(newValue) |
- { |
- if (value == newValue) |
+ Object.defineProperty(Prefs, name, { |
+ get: () => value, |
+ set: function(newValue) |
+ { |
+ if (value == newValue) |
+ return value; |
+ |
+ try |
+ { |
+ ignorePrefChanges = true; |
+ writeFunc(branch, name, newValue); |
+ value = newValue; |
+ Services.prefs.savePrefFile(null); |
+ triggerListeners(name); |
+ } |
+ catch(e) |
+ { |
+ Cu.reportError(e); |
+ } |
+ finally |
+ { |
+ ignorePrefChanges = false; |
+ } |
return value; |
- |
- try |
- { |
- ignorePrefChanges = true; |
- writeFunc(branch, name, newValue); |
- value = newValue; |
- Services.prefs.savePrefFile(null); |
- triggerListeners(name); |
- } |
- catch(e) |
- { |
- Cu.reportError(e); |
- } |
- finally |
- { |
- ignorePrefChanges = false; |
- } |
- return value; |
+ }, |
+ enumerable: true |
}); |
Prefs["_update_" + name](); |
} |