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

Side by Side Diff: lib/init.js

Issue 29449592: Issue 5183 - Provide async interface for FileSystem (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Patch Set: Remove a #include Utils.h from test. Created June 2, 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
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-2017 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 *
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 let {Prefs} = require("prefs"); 18 let {Prefs} = require("prefs");
19 let {FilterNotifier} = require("filterNotifier"); 19 let {FilterNotifier} = require("filterNotifier");
20 20
21 let prefsInitDone = false;
22 let filtersInitDone = false; 21 let filtersInitDone = false;
23 22
24 function checkInitialized() 23 function checkInitialized()
25 { 24 {
26 if (prefsInitDone && filtersInitDone) 25 if (Prefs.initialized && filtersInitDone)
27 { 26 {
28 checkInitialized = function() {}; 27 checkInitialized = function() {};
29 _triggerEvent("_init", require("filterStorage").FilterStorage.firstRun); 28 _triggerEvent("_init", require("filterStorage").FilterStorage.firstRun);
30 } 29 }
31 } 30 }
32 31
33 Prefs._initListener = function() 32 Prefs._initListener = function()
34 { 33 {
35 prefsInitDone = true;
36 checkInitialized(); 34 checkInitialized();
37 }; 35 };
38 36
37 if (Prefs.initialized)
sergei 2017/06/16 15:05:54 Could you please move all these changes in JS file
hub 2017/06/16 21:52:54 Done. https://codereview.adblockplus.org/29467599
38 checkInitialized();
39
39 FilterNotifier.addListener(function(action) 40 FilterNotifier.addListener(function(action)
40 { 41 {
41 if (action === "load") 42 if (action === "load")
42 { 43 {
43 let {FilterStorage} = require("filterStorage"); 44 let {FilterStorage} = require("filterStorage");
44 if (FilterStorage.firstRun) 45 if (FilterStorage.firstRun)
45 { 46 {
46 // No data, must be a new user or someone with corrupted data - initialize 47 // No data, must be a new user or someone with corrupted data - initialize
47 // with default settings 48 // with default settings
48 49
(...skipping 22 matching lines...) Expand all
71 FilterStorage.addSubscription(aaSubscription); 72 FilterStorage.addSubscription(aaSubscription);
72 if (aaSubscription instanceof DownloadableSubscription && !aaSubscriptio n.lastDownload) 73 if (aaSubscription instanceof DownloadableSubscription && !aaSubscriptio n.lastDownload)
73 Synchronizer.execute(aaSubscription); 74 Synchronizer.execute(aaSubscription);
74 } 75 }
75 } 76 }
76 77
77 filtersInitDone = true; 78 filtersInitDone = true;
78 checkInitialized(); 79 checkInitialized();
79 } 80 }
80 }); 81 });
OLDNEW

Powered by Google App Engine
This is Rietveld