Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: lib/init.js

Issue 29545700: Issue 5685 - Pass ESLint (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Patch Set: Created Sept. 15, 2017, 7:38 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« lib/compat.js ('K') | « lib/info.js ('k') | lib/io.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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";
19
18 let {Prefs} = require("prefs"); 20 let {Prefs} = require("prefs");
19 let {FilterNotifier} = require("filterNotifier"); 21 let {FilterNotifier} = require("filterNotifier");
20 22
21 let filtersInitDone = false; 23 let filtersInitDone = false;
22 24
23 function checkInitialized() 25 let checkInitialized = () =>
24 { 26 {
25 if (Prefs.initialized && filtersInitDone) 27 if (Prefs.initialized && filtersInitDone)
26 { 28 {
27 checkInitialized = function() {}; 29 checkInitialized = () => {};
28 _triggerEvent("_init", require("filterStorage").FilterStorage.firstRun); 30 _triggerEvent("_init", require("filterStorage").FilterStorage.firstRun);
29 } 31 }
30 } 32 };
31 33
32 Prefs._initListener = function() 34 Prefs._initListener = function()
33 { 35 {
34 checkInitialized(); 36 checkInitialized();
35 }; 37 };
36 38
37 if (Prefs.initialized) 39 if (Prefs.initialized)
38 checkInitialized(); 40 checkInitialized();
39 41
40 FilterNotifier.addListener(function(action) 42 FilterNotifier.addListener(action =>
41 { 43 {
42 if (action === "load") 44 if (action === "load")
43 { 45 {
44 let {FilterStorage} = require("filterStorage"); 46 let {FilterStorage} = require("filterStorage");
45 if (FilterStorage.firstRun) 47 if (FilterStorage.firstRun)
46 { 48 {
47 // No data, must be a new user or someone with corrupted data - initialize 49 // No data, must be a new user or someone with corrupted data - initialize
48 // with default settings 50 // with default settings
49 51
50 let {Subscription, DownloadableSubscription} = require("subscriptionClasse s"); 52 let {Subscription, DownloadableSubscription} =
sergei 2017/09/18 07:59:05 should it and a couple of lines below be rather co
hub 2017/09/18 12:43:05 Done.
53 require("subscriptionClasses");
51 let {Synchronizer} = require("synchronizer"); 54 let {Synchronizer} = require("synchronizer");
52 let {Prefs} = require("prefs");
53 let {Utils} = require("utils"); 55 let {Utils} = require("utils");
54 56
55 if (Prefs.first_run_subscription_auto_select) 57 if (Prefs.first_run_subscription_auto_select)
56 { 58 {
57 let subscriptions = require("subscriptions.xml"); 59 let subscriptions = require("subscriptions.xml");
58 let node = Utils.chooseFilterSubscription(subscriptions); 60 let node = Utils.chooseFilterSubscription(subscriptions);
59 if (node) 61 if (node)
60 { 62 {
61 let subscription = Subscription.fromURL(node.url); 63 let subscription = Subscription.fromURL(node.url);
62 subscription.disabled = false; 64 subscription.disabled = false;
63 subscription.title = node.title; 65 subscription.title = node.title;
64 subscription.homepage = node.homepage; 66 subscription.homepage = node.homepage;
65 FilterStorage.addSubscription(subscription); 67 FilterStorage.addSubscription(subscription);
66 if (subscription instanceof DownloadableSubscription && !subscription. lastDownload) 68 if (subscription instanceof DownloadableSubscription &&
69 !subscription.lastDownload)
67 Synchronizer.execute(subscription); 70 Synchronizer.execute(subscription);
68 } 71 }
69 72
70 let aaSubscription = Subscription.fromURL(Prefs.subscriptions_exceptions url); 73 let aaSubscription =
74 Subscription.fromURL(Prefs.subscriptions_exceptionsurl);
71 aaSubscription.disabled = false; 75 aaSubscription.disabled = false;
72 FilterStorage.addSubscription(aaSubscription); 76 FilterStorage.addSubscription(aaSubscription);
73 if (aaSubscription instanceof DownloadableSubscription && !aaSubscriptio n.lastDownload) 77 if (aaSubscription instanceof DownloadableSubscription &&
78 !aaSubscription.lastDownload)
74 Synchronizer.execute(aaSubscription); 79 Synchronizer.execute(aaSubscription);
75 } 80 }
76 } 81 }
77 82
78 filtersInitDone = true; 83 filtersInitDone = true;
79 checkInitialized(); 84 checkInitialized();
80 } 85 }
81 }); 86 });
OLDNEW
« lib/compat.js ('K') | « lib/info.js ('k') | lib/io.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld