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: Updated implementation. Created June 2, 2017, 3:49 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
« no previous file with comments | « include/AdblockPlus/JsEngine.h ('k') | lib/prefs.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-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)
38 checkInitialized();
hub 2017/06/02 16:04:16 This is to fix an ordering issue where this might
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
« no previous file with comments | « include/AdblockPlus/JsEngine.h ('k') | lib/prefs.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld