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

Unified Diff: lib/filterStorage.js

Issue 5450822905233408: Issue 417 - Reinitializing removed filter lists (Core/Firefox) (Closed)
Patch Set: Created May 26, 2014, 10:22 a.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
« lib/filterListener.js ('K') | « lib/filterListener.js ('k') | lib/ui.js » ('j') | 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
@@ -359,8 +359,9 @@
/**
* Loads all subscriptions from the disk
* @param {nsIFile} [sourceFile] File to read from
+ * @param {Function} [errorCallback] Function to be executed in case of an error
*/
- loadFromDisk: function(sourceFile)
+ loadFromDisk: function(sourceFile, errorCallback)
{
if (this._loading)
return;
@@ -401,7 +402,13 @@
if (!e && statData.exists)
readFile(sourceFile, backupIndex);
else
- doneReading(parser);
+ {
+ // The file is empty and loading the backup failed
+ if (typeof errorCallback == "function")
+ errorCallback();
+ else
+ doneReading(parser);
+ }
Wladimir Palant 2014/05/26 15:08:46 This callback is unnecessary and actually harmful
Thomas Greiner 2014/05/26 17:45:38 Done.
});
TimeLine.leave("FilterStorage.loadFromDisk() read callback done");
return;
« lib/filterListener.js ('K') | « lib/filterListener.js ('k') | lib/ui.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld