| Index: lib/init.js |
| =================================================================== |
| --- a/lib/init.js |
| +++ b/lib/init.js |
| @@ -15,45 +15,42 @@ |
| * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
| */ |
| let {Prefs} = require("prefs"); |
| let {FilterNotifier} = require("filterNotifier"); |
| let prefsInitDone = false; |
| let filtersInitDone = false; |
| -let isFirstRun = false; |
| function checkInitialized() |
| { |
| if (prefsInitDone && filtersInitDone) |
| { |
| checkInitialized = function() {}; |
| - _triggerEvent("init", isFirstRun); |
| + _triggerEvent("init", require("filterStorage").FilterStorage.firstRun); |
|
Felix Dahlke
2014/04/23 09:43:22
Also required below, I'd vote for doing this once
Wladimir Palant
2014/04/23 10:40:36
This isn't a real module loading mechanism here, m
Felix Dahlke
2014/04/24 11:11:41
Well, that's a leaky abstraction if there ever was
|
| } |
| } |
| Prefs._initListener = function() |
| { |
| prefsInitDone = true; |
| checkInitialized(); |
| }; |
| FilterNotifier.addListener(function(action) |
| { |
| if (action === "load") |
| { |
| let {FilterStorage} = require("filterStorage"); |
| - if (FilterStorage.subscriptions.length == 0) |
| + if (FilterStorage.firstRun) |
| { |
| // No data, must be a new user or someone with corrupted data - initialize |
| // with default settings |
| - isFirstRun = true; |
| - |
| let {Subscription, DownloadableSubscription} = require("subscriptionClasses"); |
| let {Synchronizer} = require("synchronizer"); |
| let {Prefs} = require("prefs"); |
| let {Utils} = require("utils"); |
| // Choose default subscription and add it |
| let subscriptions = require("subscriptions.xml"); |
| let node = Utils.chooseFilterSubscription(subscriptions); |