LEFT | RIGHT |
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-2016 Eyeo GmbH | 3 * Copyright (C) 2006-2017 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 |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 // in the console. | 284 // in the console. |
285 chrome.runtime.lastError; | 285 chrome.runtime.lastError; |
286 | 286 |
287 for (let key in items) | 287 for (let key in items) |
288 defaults[key] = items[key]; | 288 defaults[key] = items[key]; |
289 | 289 |
290 resolve(); | 290 resolve(); |
291 }); | 291 }); |
292 } | 292 } |
293 else | 293 else |
| 294 { |
294 resolve(); | 295 resolve(); |
| 296 } |
295 }); | 297 }); |
296 | 298 |
297 function onLoaded() | 299 function onLoaded() |
298 { | 300 { |
299 ext.storage.onChanged.addListener(changes => | 301 ext.storage.onChanged.addListener(changes => |
300 { | 302 { |
301 for (let key in changes) | 303 for (let key in changes) |
302 { | 304 { |
303 let pref = keyToPref(key); | 305 let pref = keyToPref(key); |
304 if (pref && pref in defaults) | 306 if (pref && pref in defaults) |
305 { | 307 { |
306 let change = changes[key]; | 308 let change = changes[key]; |
307 if ("newValue" in change && change.newValue != defaults[pref]) | 309 if ("newValue" in change && change.newValue != defaults[pref]) |
308 overrides[pref] = change.newValue; | 310 overrides[pref] = change.newValue; |
309 else | 311 else |
310 delete overrides[pref]; | 312 delete overrides[pref]; |
311 | 313 |
312 eventEmitter.emit(pref); | 314 eventEmitter.emit(pref); |
313 } | 315 } |
314 } | 316 } |
315 }); | 317 }); |
316 } | 318 } |
317 | 319 |
318 Prefs.untilLoaded = Promise.all([localLoaded, managedLoaded]).then(onLoaded); | 320 Prefs.untilLoaded = Promise.all([localLoaded, managedLoaded]).then(onLoaded); |
319 } | 321 } |
320 | 322 |
321 init(); | 323 init(); |
LEFT | RIGHT |