Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/prefs.js

Issue 5519479341580288: Issue 2437 - Update adblockplus dependency to revision 752ffe2eeaf1 (Closed)
Patch Set: Make the properties enumerable Created April 30, 2015, 1:14 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ensure_dependencies.py ('k') | test/UpdateCheck.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/prefs.js
===================================================================
--- a/lib/prefs.js
+++ b/lib/prefs.js
@@ -52,20 +52,24 @@
function defineProperty(key)
{
- Prefs.__defineGetter__(key, function() values[key]);
- Prefs.__defineSetter__(key, function(value)
+ Object.defineProperty(Prefs, key,
{
- if (typeof value != typeof defaults[key])
- throw new Error("Attempt to change preference type");
+ get: () => values[key],
+ set: function(value)
+ {
+ if (typeof value != typeof defaults[key])
+ throw new Error("Attempt to change preference type");
- if (value == defaults[key])
- delete values[key];
- else
- values[key] = value;
- save();
+ if (value == defaults[key])
+ delete values[key];
+ else
+ values[key] = value;
+ save();
- for (let listener of listeners)
- listener(key);
+ for (let listener of listeners)
+ listener(key);
+ },
+ enumerable: true
});
}
« no previous file with comments | « ensure_dependencies.py ('k') | test/UpdateCheck.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld