LEFT | RIGHT |
(no file at all) | |
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 |
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 * |
14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
16 */ | 16 */ |
17 | 17 |
18 "use strict"; | 18 "use strict"; |
19 | 19 |
20 const {FilterNotifier} = require("../adblockpluscore/lib/filterNotifier"); | 20 const {filterNotifier} = require("../adblockpluscore/lib/filterNotifier"); |
21 const {FilterStorage} = require("../adblockpluscore/lib/filterStorage"); | 21 const {FilterStorage} = require("../adblockpluscore/lib/filterStorage"); |
22 const {DownloadableSubscription, SpecialSubscription} = | 22 const {DownloadableSubscription, SpecialSubscription} = |
23 require("../adblockpluscore/lib/subscriptionClasses"); | 23 require("../adblockpluscore/lib/subscriptionClasses"); |
24 | 24 |
25 const BACKUP_NAME = "file:indexedDB-backup"; | 25 const BACKUP_NAME = "file:indexedDB-backup"; |
26 | 26 |
27 let backupDelay; | 27 let backupDelay; |
28 let pendingBackup = false; | 28 let pendingBackup = false; |
29 | 29 |
30 function setBackupInterval(backupInterval = 60 * 1000) | 30 function setBackupInterval(backupInterval = 60 * 1000) |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 return browser.storage.local.get(BACKUP_NAME).then(items => | 94 return browser.storage.local.get(BACKUP_NAME).then(items => |
95 { | 95 { |
96 let entry = items[BACKUP_NAME]; | 96 let entry = items[BACKUP_NAME]; |
97 if (entry) | 97 if (entry) |
98 return entry; | 98 return entry; |
99 | 99 |
100 throw {type: "NoSuchFile"}; | 100 throw {type: "NoSuchFile"}; |
101 }); | 101 }); |
102 } | 102 } |
103 | 103 |
104 FilterNotifier.on("load", scheduleBackup); | 104 filterNotifier.on("load", scheduleBackup); |
105 FilterNotifier.on("subscription.updated", scheduleBackup); | 105 filterNotifier.on("subscription.updated", scheduleBackup); |
106 FilterNotifier.on("subscription.added", scheduleBackup); | 106 filterNotifier.on("subscription.added", scheduleBackup); |
107 FilterNotifier.on("subscription.removed", scheduleBackup); | 107 filterNotifier.on("subscription.removed", scheduleBackup); |
108 FilterNotifier.on("subscription.disabled", scheduleBackup); | 108 filterNotifier.on("subscription.disabled", scheduleBackup); |
109 FilterNotifier.on("filter.added", scheduleBackup); | 109 filterNotifier.on("filter.added", scheduleBackup); |
110 FilterNotifier.on("filter.removed", scheduleBackup); | 110 filterNotifier.on("filter.removed", scheduleBackup); |
111 FilterNotifier.on("filter.moved", scheduleBackup); | 111 filterNotifier.on("filter.moved", scheduleBackup); |
112 FilterNotifier.on("filter.disabled", scheduleBackup); | 112 filterNotifier.on("filter.disabled", scheduleBackup); |
113 | 113 |
114 exports.IndexedDBBackup = | 114 exports.IndexedDBBackup = |
115 { | 115 { |
116 getBackupData, | 116 getBackupData, |
117 // Non-public API, just for tests. | 117 // Non-public API, just for tests. |
118 setBackupInterval | 118 setBackupInterval |
119 }; | 119 }; |
LEFT | RIGHT |