| OLD | NEW |
| 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-present eyeo GmbH | 3 * Copyright (C) 2006-present 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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 { | 283 { |
| 284 return keyPrefix + pref; | 284 return keyPrefix + pref; |
| 285 } | 285 } |
| 286 | 286 |
| 287 function savePref(pref) | 287 function savePref(pref) |
| 288 { | 288 { |
| 289 return browser.storage.local.set({[prefToKey(pref)]: overrides[pref]}); | 289 return browser.storage.local.set({[prefToKey(pref)]: overrides[pref]}); |
| 290 } | 290 } |
| 291 | 291 |
| 292 let customSave = new Map(); | 292 let customSave = new Map(); |
| 293 if (require("../buildtools/info").platform == "gecko") | 293 if (require("info").platform == "gecko") |
| 294 { | 294 { |
| 295 // Saving one storage value causes all others to be saved as well on Gecko. | 295 // Saving one storage value causes all others to be saved as well on Gecko. |
| 296 // Make sure that updating ad counter doesn't cause the filters data to be | 296 // Make sure that updating ad counter doesn't cause the filters data to be |
| 297 // saved frequently as a side-effect. | 297 // saved frequently as a side-effect. |
| 298 const MIN_UPDATE_INTERVAL = 60 * 1000; | 298 const MIN_UPDATE_INTERVAL = 60 * 1000; |
| 299 let lastUpdate = -MIN_UPDATE_INTERVAL; | 299 let lastUpdate = -MIN_UPDATE_INTERVAL; |
| 300 let promise = null; | 300 let promise = null; |
| 301 customSave.set("blocked_total", pref => | 301 customSave.set("blocked_total", pref => |
| 302 { | 302 { |
| 303 if (!promise) | 303 if (!promise) |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 eventEmitter.emit(pref); | 382 eventEmitter.emit(pref); |
| 383 } | 383 } |
| 384 } | 384 } |
| 385 }); | 385 }); |
| 386 } | 386 } |
| 387 | 387 |
| 388 Prefs.untilLoaded = Promise.all([localLoaded, managedLoaded]).then(onLoaded); | 388 Prefs.untilLoaded = Promise.all([localLoaded, managedLoaded]).then(onLoaded); |
| 389 } | 389 } |
| 390 | 390 |
| 391 init(); | 391 init(); |
| OLD | NEW |