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

Delta Between Two Patch Sets: lib/prefs.js

Issue 5519479341580288: Issue 2437 - Update adblockplus dependency to revision 752ffe2eeaf1 (Closed)
Left Patch Set: Use an arrow function and Object.defineProperty Created April 30, 2015, 5:05 a.m.
Right Patch Set: Run ensure_dependencies.py during the build Created May 29, 2015, 7:12 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
LEFTRIGHT
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 throw new Error("Attempt to change preference type"); 61 throw new Error("Attempt to change preference type");
62 62
63 if (value == defaults[key]) 63 if (value == defaults[key])
64 delete values[key]; 64 delete values[key];
65 else 65 else
66 values[key] = value; 66 values[key] = value;
67 save(); 67 save();
68 68
69 for (let listener of listeners) 69 for (let listener of listeners)
70 listener(key); 70 listener(key);
71 } 71 },
Wladimir Palant 2015/04/30 08:30:24 enumerable: true please, otherwise debugging will
Felix Dahlke 2015/04/30 13:17:38 Done.
72 enumerable: true
72 }); 73 });
73 } 74 }
74 75
75 function load() 76 function load()
76 { 77 {
77 _fileSystem.read(path, function(result) 78 _fileSystem.read(path, function(result)
78 { 79 {
79 // prefs.json is expected to be missing, ignore errors reading file 80 // prefs.json is expected to be missing, ignore errors reading file
80 if (!result.error) 81 if (!result.error)
81 { 82 {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 let index = listeners.indexOf(listener); 128 let index = listeners.indexOf(listener);
128 if (index >= 0) 129 if (index >= 0)
129 listeners.splice(index, 1); 130 listeners.splice(index, 1);
130 }, 131 },
131 }; 132 };
132 133
133 for (let key in defaults) 134 for (let key in defaults)
134 defineProperty(key); 135 defineProperty(key);
135 136
136 load(); 137 load();
LEFTRIGHT

Powered by Google App Engine
This is Rietveld