| OLD | NEW |
| 1 /* | 1 /* |
| 2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
| 3 * Copyright (C) 2006-2014 Eyeo GmbH | 3 * Copyright (C) 2006-2014 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 { | 54 { |
| 55 if (typeof value != typeof defaults[key]) | 55 if (typeof value != typeof defaults[key]) |
| 56 throw new Error("Attempt to change preference type"); | 56 throw new Error("Attempt to change preference type"); |
| 57 | 57 |
| 58 if (value == defaults[key]) | 58 if (value == defaults[key]) |
| 59 delete values[key]; | 59 delete values[key]; |
| 60 else | 60 else |
| 61 values[key] = value; | 61 values[key] = value; |
| 62 save(); | 62 save(); |
| 63 | 63 |
| 64 for each (let listener in listeners) | 64 for (let listener of listeners) |
| 65 listener(key); | 65 listener(key); |
| 66 }); | 66 }); |
| 67 } | 67 } |
| 68 | 68 |
| 69 function load() | 69 function load() |
| 70 { | 70 { |
| 71 _fileSystem.read(path, function(result) | 71 _fileSystem.read(path, function(result) |
| 72 { | 72 { |
| 73 // prefs.json is expected to be missing, ignore errors reading file | 73 // prefs.json is expected to be missing, ignore errors reading file |
| 74 if (!result.error) | 74 if (!result.error) |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 let index = listeners.indexOf(listener); | 121 let index = listeners.indexOf(listener); |
| 122 if (index >= 0) | 122 if (index >= 0) |
| 123 listeners.splice(index, 1); | 123 listeners.splice(index, 1); |
| 124 }, | 124 }, |
| 125 }; | 125 }; |
| 126 | 126 |
| 127 for (let key in defaults) | 127 for (let key in defaults) |
| 128 defineProperty(key); | 128 defineProperty(key); |
| 129 | 129 |
| 130 load(); | 130 load(); |
| OLD | NEW |