Index: lib/filterStorage.js |
=================================================================== |
--- a/lib/filterStorage.js |
+++ b/lib/filterStorage.js |
@@ -42,16 +42,22 @@ let formatVersion = 4; |
/** |
* This class reads user's filters from disk, manages them in memory |
* and writes them back. |
* @class |
*/ |
let FilterStorage = exports.FilterStorage = |
{ |
/** |
+ * Will be set to true after the initial loadFromDisk() call completes. |
+ * @type {boolean} |
+ */ |
+ initialized: false, |
+ |
+ /** |
* Version number of the patterns.ini format used. |
* @type {number} |
*/ |
get formatVersion() |
{ |
return formatVersion; |
}, |
@@ -458,16 +464,18 @@ let FilterStorage = exports.FilterStorag |
{ |
let readFile = () => |
{ |
let parser = { |
process: this.importData() |
}; |
IO.readFromFile(this.sourceFile, parser, readFromFileException => |
{ |
+ this.initialized = true; |
+ |
if (!readFromFileException && this.subscriptions.length == 0) |
{ |
// No filter subscriptions in the file, this isn't right. |
readFromFileException = new Error("No data in the file"); |
} |
if (readFromFileException) |
Cu.reportError(readFromFileException); |
@@ -489,16 +497,17 @@ let FilterStorage = exports.FilterStorag |
}); |
}; |
IO.statFile(this.sourceFile, (statError, statData) => |
{ |
if (statError || !statData.exists) |
{ |
this.firstRun = true; |
+ this.initialized = true; |
FilterNotifier.triggerListeners("load"); |
} |
else |
readFile(); |
}); |
}, |
/** |