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 |
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 /** @module subscriptionInit */ | 18 /** @module subscriptionInit */ |
19 | 19 |
20 "use strict"; | 20 "use strict"; |
21 | 21 |
22 const {Subscription, | 22 const {Subscription, |
23 DownloadableSubscription, | 23 DownloadableSubscription, |
24 SpecialSubscription} = | 24 SpecialSubscription} = |
25 require("../adblockpluscore/lib/subscriptionClasses"); | 25 require("../adblockpluscore/lib/subscriptionClasses"); |
26 const {FilterStorage} = require("../adblockpluscore/lib/filterStorage"); | 26 const {FilterStorage} = require("../adblockpluscore/lib/filterStorage"); |
27 const {FilterNotifier} = require("../adblockpluscore/lib/filterNotifier"); | 27 const {filterNotifier} = require("../adblockpluscore/lib/filterNotifier"); |
28 const info = require("info"); | 28 const info = require("info"); |
29 const {Prefs} = require("./prefs"); | 29 const {Prefs} = require("./prefs"); |
30 const {Synchronizer} = require("../adblockpluscore/lib/synchronizer"); | 30 const {Synchronizer} = require("../adblockpluscore/lib/synchronizer"); |
31 const {Utils} = require("./utils"); | 31 const {Utils} = require("./utils"); |
32 const {initNotifications} = require("./notificationHelper"); | 32 const {initNotifications} = require("./notificationHelper"); |
33 const {updatesVersion} = require("../adblockplusui/lib/prefs"); | 33 const {updatesVersion} = require("../adblockplusui/lib/prefs"); |
34 | 34 |
35 let firstRun; | 35 let firstRun; |
36 let subscriptionsCallback = null; | 36 let subscriptionsCallback = null; |
37 let reinitialized = false; | 37 let reinitialized = false; |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 url = "firstRun.html"; | 294 url = "firstRun.html"; |
295 else | 295 else |
296 url = "updates.html"; | 296 url = "updates.html"; |
297 browser.tabs.create({url}); | 297 browser.tabs.create({url}); |
298 } | 298 } |
299 }); | 299 }); |
300 } | 300 } |
301 } | 301 } |
302 | 302 |
303 Promise.all([ | 303 Promise.all([ |
304 FilterNotifier.once("load"), | 304 filterNotifier.once("load"), |
305 Prefs.untilLoaded.catch(() => { dataCorrupted = true; }) | 305 Prefs.untilLoaded.catch(() => { dataCorrupted = true; }) |
306 ]).then(detectFirstRun) | 306 ]).then(detectFirstRun) |
307 .then(getSubscriptions) | 307 .then(getSubscriptions) |
308 .then(addSubscriptionsAndNotifyUser) | 308 .then(addSubscriptionsAndNotifyUser) |
309 // We have to require the "uninstall" module on demand, | 309 // We have to require the "uninstall" module on demand, |
310 // as the "uninstall" module in turn requires this module. | 310 // as the "uninstall" module in turn requires this module. |
311 .then(() => { require("./uninstall").setUninstallURL(); }) | 311 .then(() => { require("./uninstall").setUninstallURL(); }) |
312 .then(initNotifications); | 312 .then(initNotifications); |
313 | 313 |
314 /** | 314 /** |
(...skipping 19 matching lines...) Expand all Loading... |
334 * | 334 * |
335 * @param {function} callback | 335 * @param {function} callback |
336 */ | 336 */ |
337 exports.setSubscriptionsCallback = callback => | 337 exports.setSubscriptionsCallback = callback => |
338 { | 338 { |
339 subscriptionsCallback = callback; | 339 subscriptionsCallback = callback; |
340 }; | 340 }; |
341 | 341 |
342 // Exports for tests only | 342 // Exports for tests only |
343 exports.chooseFilterSubscriptions = chooseFilterSubscriptions; | 343 exports.chooseFilterSubscriptions = chooseFilterSubscriptions; |
OLD | NEW |