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

Unified Diff: lib/filterStorage.js

Issue 6305806509146112: Issue 427 - Remove non-standard function and getter syntax (Closed)
Patch Set: Convert shorthand function expressions to arrow functions, this of course isn't possible for getter… Created May 10, 2014, 12:43 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
Index: lib/filterStorage.js
===================================================================
--- a/lib/filterStorage.js
+++ b/lib/filterStorage.js
@@ -42,17 +42,17 @@ let formatVersion = 4;
* @class
*/
let FilterStorage = exports.FilterStorage =
{
/**
* Version number of the patterns.ini format used.
* @type Integer
*/
- get formatVersion() formatVersion,
+ get formatVersion() { return formatVersion },
Wladimir Palant 2014/05/15 07:12:38 Nit: Please add proper line breaks here.
/**
* File that the filter list has been loaded from and should be saved to
* @type nsIFile
*/
get sourceFile()
{
let file = null;
@@ -77,17 +77,17 @@ let FilterStorage = exports.FilterStorag
if (file)
file.append("patterns.ini");
} catch(e) {}
}
if (!file)
Cu.reportError("Adblock Plus: Failed to resolve filter file location from extensions.adblockplus.patternsfile preference");
- this.__defineGetter__("sourceFile", function() file);
+ this.__defineGetter__("sourceFile", () => file);
return this.sourceFile;
},
/**
* Will be set to true if no patterns.ini file exists.
* @type Boolean
*/
firstRun: false,
@@ -220,17 +220,17 @@ let FilterStorage = exports.FilterStorag
* @param {SpecialSubscription} [subscription] particular group that the filter should be added to
* @param {Integer} [position] position within the subscription at which the filter should be added
* @param {Boolean} silent if true, no listeners will be triggered (to be used when filter list is reloaded)
*/
addFilter: function(filter, subscription, position, silent)
{
if (!subscription)
{
- if (filter.subscriptions.some(function(s) s instanceof SpecialSubscription && !s.disabled))
+ if (filter.subscriptions.some(s => s instanceof SpecialSubscription && !s.disabled))
return; // No need to add
subscription = FilterStorage.getGroupForFilter(filter);
}
if (!subscription)
{
// No group for this filter exists, create one
subscription = SpecialSubscription.createForFilter(filter);
this.addSubscription(subscription);
@@ -623,44 +623,44 @@ let FilterStorage = exports.FilterStorag
}
}.bind(this);
let removeLastBackup = function(part1, part2)
{
TimeLine.enter("FilterStorage.saveToDisk() -> removeLastBackup()");
let file = targetFile.clone();
file.leafName = part1 + "-backup" + Prefs.patternsbackups + part2;
- IO.removeFile(file, function(e) renameBackup(part1, part2, Prefs.patternsbackups - 1));
+ IO.removeFile(file, (e) => renameBackup(part1, part2, Prefs.patternsbackups - 1));
TimeLine.leave("FilterStorage.saveToDisk() <- removeLastBackup()");
}.bind(this);
let renameBackup = function(part1, part2, index)
{
TimeLine.enter("FilterStorage.saveToDisk() -> renameBackup()");
if (index > 0)
{
let fromFile = targetFile.clone();
fromFile.leafName = part1 + "-backup" + index + part2;
let toName = part1 + "-backup" + (index + 1) + part2;
- IO.renameFile(fromFile, toName, function(e) renameBackup(part1, part2, index - 1));
+ IO.renameFile(fromFile, toName, (e) => renameBackup(part1, part2, index - 1));
}
else
{
let toFile = targetFile.clone();
toFile.leafName = part1 + "-backup" + (index + 1) + part2;
IO.copyFile(targetFile, toFile, writeFilters);
}
TimeLine.leave("FilterStorage.saveToDisk() <- renameBackup()");
}.bind(this);
// Do not persist external subscriptions
- let subscriptions = this.subscriptions.filter(function(s) !(s instanceof ExternalSubscription));
+ let subscriptions = this.subscriptions.filter((s) => !(s instanceof ExternalSubscription));
if (!explicitFile)
this._saving = true;
checkBackupRequired(writeFilters, removeLastBackup);
TimeLine.leave("FilterStorage.saveToDisk() done");
},

Powered by Google App Engine
This is Rietveld