Index: test/filterStorage_readwrite.js
===================================================================
--- a/test/filterStorage_readwrite.js
+++ b/test/filterStorage_readwrite.js
@@ -15,34 +15,34 @@
  * along with Adblock Plus.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 "use strict";
 
 const {createSandbox, unexpectedError} = require("./_common");
 
 let Filter = null;
-let FilterStorage = null;
+let filterStorage = null;
 let IO = null;
 let Prefs = null;
 let ExternalSubscription = null;
 let SpecialSubscription = null;
 
 exports.setUp = function(callback)
 {
   let sandboxedRequire = createSandbox();
   (
     {Filter} = sandboxedRequire("../lib/filterClasses"),
-    {FilterStorage} = sandboxedRequire("../lib/filterStorage"),
+    {filterStorage} = sandboxedRequire("../lib/filterStorage"),
     {IO} = sandboxedRequire("./stub-modules/io"),
     {Prefs} = sandboxedRequire("./stub-modules/prefs"),
     {ExternalSubscription, SpecialSubscription} = sandboxedRequire("../lib/subscriptionClasses")
   );
 
-  FilterStorage.addFilter(Filter.fromText("foobar"));
+  filterStorage.addFilter(Filter.fromText("foobar"));
   callback();
 };
 
 let testData = new Promise((resolve, reject) =>
 {
   const fs = require("fs");
   const path = require("path");
   let datapath = path.resolve(__dirname, "data", "patterns.ini");
@@ -88,60 +88,60 @@
       return 1;
     return 0;
   });
   return sections;
 }
 
 function testReadWrite(test, withExternal, withEmptySpecial)
 {
-  test.ok(!FilterStorage.initialized, "Uninitialized before the first load");
+  test.ok(!filterStorage.initialized, "Uninitialized before the first load");
 
   return testData.then(data =>
   {
-    IO._setFileContents(FilterStorage.sourceFile, data);
-    return FilterStorage.loadFromDisk();
+    IO._setFileContents(filterStorage.sourceFile, data);
+    return filterStorage.loadFromDisk();
   }).then(() =>
   {
-    test.ok(FilterStorage.initialized, "Initialize after the first load");
-    test.equal(FilterStorage.fileProperties.version, FilterStorage.formatVersion, "File format version");
+    test.ok(filterStorage.initialized, "Initialize after the first load");
+    test.equal(filterStorage.fileProperties.version, filterStorage.formatVersion, "File format version");
 
     if (withExternal)
     {
       {
         let subscription = new ExternalSubscription("~external~external subscription ID", "External subscription");
         subscription.filters = [Filter.fromText("foo"), Filter.fromText("bar")];
-        FilterStorage.addSubscription(subscription);
+        filterStorage.addSubscription(subscription);
       }
 
-      let externalSubscriptions = [...FilterStorage.subscriptions()].filter(subscription => subscription instanceof ExternalSubscription);
+      let externalSubscriptions = [...filterStorage.subscriptions()].filter(subscription => subscription instanceof ExternalSubscription);
       test.equal(externalSubscriptions.length, 1, "Number of external subscriptions after updateExternalSubscription");
 
       test.equal(externalSubscriptions[0].url, "~external~external subscription ID", "ID of external subscription");
       test.equal(externalSubscriptions[0].filters.length, 2, "Number of filters in external subscription");
     }
 
     if (withEmptySpecial)
     {
       let specialSubscription =
         SpecialSubscription.createForFilter(Filter.fromText("!foo"));
-      FilterStorage.addSubscription(specialSubscription);
+      filterStorage.addSubscription(specialSubscription);
 
-      FilterStorage.removeFilter(Filter.fromText("!foo"), specialSubscription);
+      filterStorage.removeFilter(Filter.fromText("!foo"), specialSubscription);
 
       test.equal(specialSubscription.filters.length, 0,
                  "No filters in special subscription");
-      test.ok(new Set(FilterStorage.subscriptions()).has(specialSubscription),
+      test.ok(new Set(filterStorage.subscriptions()).has(specialSubscription),
               "Empty special subscription still in storage");
     }
 
-    return FilterStorage.saveToDisk();
+    return filterStorage.saveToDisk();
   }).then(() => testData).then(expected =>
   {
-    test.deepEqual(canonize(IO._getFileContents(FilterStorage.sourceFile)),
+    test.deepEqual(canonize(IO._getFileContents(filterStorage.sourceFile)),
                canonize(expected), "Read/write result");
   }).catch(unexpectedError.bind(test)).then(() => test.done());
 }
 
 exports.testReadAndSaveToFile = function(test)
 {
   testReadWrite(test, false);
 };
@@ -158,115 +158,115 @@
 
 exports.testImportExport = function(test)
 {
   testData.then(lines =>
   {
     if (lines.length && lines[lines.length - 1] == "")
       lines.pop();
 
-    let importer = FilterStorage.importData();
+    let importer = filterStorage.importData();
     for (let line of lines)
       importer(line);
     importer(null);
 
-    test.equal(FilterStorage.fileProperties.version, FilterStorage.formatVersion, "File format version");
+    test.equal(filterStorage.fileProperties.version, filterStorage.formatVersion, "File format version");
 
-    let exported = Array.from(FilterStorage.exportData());
+    let exported = Array.from(filterStorage.exportData());
     test.deepEqual(canonize(exported), canonize(lines), "Import/export result");
   }).catch(unexpectedError.bind(test)).then(() => test.done());
 };
 
 exports.testSavingWithoutBackups = function(test)
 {
   Prefs.patternsbackups = 0;
   Prefs.patternsbackupinterval = 24;
 
-  FilterStorage.saveToDisk().then(() =>
+  filterStorage.saveToDisk().then(() =>
   {
-    return FilterStorage.saveToDisk();
+    return filterStorage.saveToDisk();
   }).then(() =>
   {
-    test.ok(!IO._getFileContents(FilterStorage.getBackupName(1)),
+    test.ok(!IO._getFileContents(filterStorage.getBackupName(1)),
             "Backup shouldn't be created");
   }).catch(unexpectedError.bind(test)).then(() => test.done());
 };
 
 exports.testSavingWithBackups = function(test)
 {
   Prefs.patternsbackups = 2;
   Prefs.patternsbackupinterval = 24;
 
-  let backupFile = FilterStorage.getBackupName(1);
-  let backupFile2 = FilterStorage.getBackupName(2);
-  let backupFile3 = FilterStorage.getBackupName(3);
+  let backupFile = filterStorage.getBackupName(1);
+  let backupFile2 = filterStorage.getBackupName(2);
+  let backupFile3 = filterStorage.getBackupName(3);
 
   let oldModifiedTime;
 
-  FilterStorage.saveToDisk().then(() =>
+  filterStorage.saveToDisk().then(() =>
   {
     // Save again immediately
-    return FilterStorage.saveToDisk();
+    return filterStorage.saveToDisk();
   }).then(() =>
   {
     test.ok(IO._getFileContents(backupFile), "First backup created");
 
     oldModifiedTime = IO._getModifiedTime(backupFile) - 10000;
     IO._setModifiedTime(backupFile, oldModifiedTime);
-    return FilterStorage.saveToDisk();
+    return filterStorage.saveToDisk();
   }).then(() =>
   {
     test.equal(IO._getModifiedTime(backupFile), oldModifiedTime, "Backup not overwritten if it is only 10 seconds old");
 
     oldModifiedTime -= 40 * 60 * 60 * 1000;
     IO._setModifiedTime(backupFile, oldModifiedTime);
-    return FilterStorage.saveToDisk();
+    return filterStorage.saveToDisk();
   }).then(() =>
   {
     test.notEqual(IO._getModifiedTime(backupFile), oldModifiedTime, "Backup overwritten if it is 40 hours old");
 
     test.ok(IO._getFileContents(backupFile2), "Second backup created when first backup is overwritten");
 
     IO._setModifiedTime(backupFile, IO._getModifiedTime(backupFile) - 20000);
     oldModifiedTime = IO._getModifiedTime(backupFile2);
-    return FilterStorage.saveToDisk();
+    return filterStorage.saveToDisk();
   }).then(() =>
   {
     test.equal(IO._getModifiedTime(backupFile2), oldModifiedTime, "Second backup not overwritten if first one is only 20 seconds old");
 
     IO._setModifiedTime(backupFile, IO._getModifiedTime(backupFile) - 25 * 60 * 60 * 1000);
     oldModifiedTime = IO._getModifiedTime(backupFile2);
-    return FilterStorage.saveToDisk();
+    return filterStorage.saveToDisk();
   }).then(() =>
   {
     test.notEqual(IO._getModifiedTime(backupFile2), oldModifiedTime, "Second backup overwritten if first one is 25 hours old");
 
     test.ok(!IO._getFileContents(backupFile3), "Third backup not created with patternsbackups = 2");
   }).catch(unexpectedError.bind(test)).then(() => test.done());
 };
 
 exports.testRestoringBackup = function(test)
 {
   Prefs.patternsbackups = 2;
   Prefs.patternsbackupinterval = 24;
 
-  FilterStorage.saveToDisk().then(() =>
+  filterStorage.saveToDisk().then(() =>
   {
-    test.equal([...FilterStorage.subscriptions()][0].filters.length, 1, "Initial filter count");
-    FilterStorage.addFilter(Filter.fromText("barfoo"));
-    test.equal([...FilterStorage.subscriptions()][0].filters.length, 2, "Filter count after adding a filter");
-    return FilterStorage.saveToDisk();
+    test.equal([...filterStorage.subscriptions()][0].filters.length, 1, "Initial filter count");
+    filterStorage.addFilter(Filter.fromText("barfoo"));
+    test.equal([...filterStorage.subscriptions()][0].filters.length, 2, "Filter count after adding a filter");
+    return filterStorage.saveToDisk();
   }).then(() =>
   {
-    return FilterStorage.loadFromDisk();
+    return filterStorage.loadFromDisk();
   }).then(() =>
   {
-    test.equal([...FilterStorage.subscriptions()][0].filters.length, 2, "Filter count after adding filter and reloading");
-    return FilterStorage.restoreBackup(1);
+    test.equal([...filterStorage.subscriptions()][0].filters.length, 2, "Filter count after adding filter and reloading");
+    return filterStorage.restoreBackup(1);
   }).then(() =>
   {
-    test.equal([...FilterStorage.subscriptions()][0].filters.length, 1, "Filter count after restoring backup");
-    return FilterStorage.loadFromDisk();
+    test.equal([...filterStorage.subscriptions()][0].filters.length, 1, "Filter count after restoring backup");
+    return filterStorage.loadFromDisk();
   }).then(() =>
   {
-    test.equal([...FilterStorage.subscriptions()][0].filters.length, 1, "Filter count after reloading");
+    test.equal([...filterStorage.subscriptions()][0].filters.length, 1, "Filter count after reloading");
   }).catch(unexpectedError.bind(test)).then(() => test.done());
 };
