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

Unified Diff: lib/filterStorage.js

Issue 8736021: Topic 10992 - Fallback if patterns.ini doesn`t exist doesn`t work (Closed)
Patch Set: Created Oct. 31, 2012, 3:19 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/filterStorage.js
===================================================================
--- a/lib/filterStorage.js
+++ b/lib/filterStorage.js
@@ -371,62 +371,68 @@ let FilterStorage = exports.FilterStorag
sourceFile = sourceFile.clone();
sourceFile.leafName = part1 + "-backup" + (++backupIndex) + part2;
IO.statFile(sourceFile, function(e, statData)
{
if (!e && statData.exists)
readFile(sourceFile, backupIndex);
+ else
+ doneReading(parser);
});
TimeLine.leave("FilterStorage.loadFromDisk() read callback done");
return;
}
}
-
- // Old special groups might have been converted, remove them if they are empty
- let specialMap = {"~il~": true, "~wl~": true, "~fl~": true, "~eh~": true};
- let knownSubscriptions = {__proto__: null};
- for (let i = 0; i < parser.subscriptions.length; i++)
- {
- let subscription = parser.subscriptions[i];
- if (subscription instanceof SpecialSubscription && subscription.filters.length == 0 && subscription.url in specialMap)
- parser.subscriptions.splice(i--, 1);
- else
- knownSubscriptions[subscription.url] = subscription;
- }
-
- this.fileProperties = parser.fileProperties;
- this.subscriptions = parser.subscriptions;
- this.knownSubscriptions = knownSubscriptions;
- Filter.knownFilters = parser.knownFilters;
- Subscription.knownSubscriptions = parser.knownSubscriptions;
-
- if (parser.userFilters)
- {
- for (let i = 0; i < parser.userFilters.length; i++)
- {
- let filter = Filter.fromText(parser.userFilters[i]);
- this.addFilter(filter, null, undefined, true);
- }
- }
- TimeLine.log("Initializing data done, triggering observers")
-
- this._loading = false;
- FilterNotifier.triggerListeners("load");
-
- if (sourceFile != this.sourceFile)
- this.saveToDisk();
-
- TimeLine.leave("FilterStorage.loadFromDisk() read callback done");
+ doneReading(parser);
}.bind(this), "FilterStorageRead");
TimeLine.leave("FilterStorage.loadFromDisk() <- readFile()", "FilterStorageRead");
}.bind(this);
+ var doneReading = function(parser)
+ {
+ // Old special groups might have been converted, remove them if they are empty
+ let specialMap = {"~il~": true, "~wl~": true, "~fl~": true, "~eh~": true};
+ let knownSubscriptions = {__proto__: null};
+ for (let i = 0; i < parser.subscriptions.length; i++)
+ {
+ let subscription = parser.subscriptions[i];
+ if (subscription instanceof SpecialSubscription && subscription.filters.length == 0 && subscription.url in specialMap)
+ parser.subscriptions.splice(i--, 1);
+ else
+ knownSubscriptions[subscription.url] = subscription;
+ }
+
+ this.fileProperties = parser.fileProperties;
+ this.subscriptions = parser.subscriptions;
+ this.knownSubscriptions = knownSubscriptions;
+ Filter.knownFilters = parser.knownFilters;
+ Subscription.knownSubscriptions = parser.knownSubscriptions;
+
+ if (parser.userFilters)
+ {
+ for (let i = 0; i < parser.userFilters.length; i++)
+ {
+ let filter = Filter.fromText(parser.userFilters[i]);
+ this.addFilter(filter, null, undefined, true);
+ }
+ }
+ TimeLine.log("Initializing data done, triggering observers")
+
+ this._loading = false;
+ FilterNotifier.triggerListeners("load");
+
+ if (sourceFile != this.sourceFile)
+ this.saveToDisk();
+
+ TimeLine.leave("FilterStorage.loadFromDisk() read callback done");
+ }.bind(this);
+
let startRead = function(file)
{
this._loading = true;
readFile(file, 0);
}.bind(this);
let explicitFile;
if (sourceFile)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld