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

Unified Diff: lib/filterListener.js

Issue 29912619: Issue 6891, 6741 - Rename FilterStorage to filterStorage (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Minor update Created Oct. 16, 2018, 10:02 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 | lib/filterStorage.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/filterListener.js
===================================================================
--- a/lib/filterListener.js
+++ b/lib/filterListener.js
@@ -20,17 +20,17 @@
/**
* @fileOverview Component synchronizing filter storage with Matcher
* instances and ElemHide.
*/
const {Services} = Cu.import("resource://gre/modules/Services.jsm", {});
const {XPCOMUtils} = Cu.import("resource://gre/modules/XPCOMUtils.jsm", {});
-const {FilterStorage} = require("./filterStorage");
+const {filterStorage} = require("./filterStorage");
const {filterNotifier} = require("./filterNotifier");
const {ElemHide} = require("./elemHide");
const {ElemHideEmulation} = require("./elemHideEmulation");
const {ElemHideExceptions} = require("./elemHideExceptions");
const {Snippets} = require("./snippets");
const {defaultMatcher} = require("./matcher");
const {ActiveFilter, RegExpFilter,
ElemHideBase, ElemHideFilter, ElemHideEmulationFilter,
@@ -46,47 +46,47 @@
/**
* This object can be used to change properties of the filter change listeners.
* @class
*/
let FilterListener = {
/**
* Increases "dirty factor" of the filters and calls
- * FilterStorage.saveToDisk() if it becomes 1 or more. Save is
+ * filterStorage.saveToDisk() if it becomes 1 or more. Save is
* executed delayed to prevent multiple subsequent calls. If the
* parameter is 0 it forces saving filters if any changes were
* recorded after the previous save.
* @param {number} factor
*/
setDirty(factor)
{
if (factor == 0 && isDirty > 0)
isDirty = 1;
else
isDirty += factor;
if (isDirty >= 1)
{
isDirty = 0;
- FilterStorage.saveToDisk();
+ filterStorage.saveToDisk();
}
}
};
/**
* Observer listening to history purge actions.
* @class
*/
let HistoryPurgeObserver = {
observe(subject, topic, data)
{
if (topic == "browser:purge-session-history" &&
Prefs.clearStatsOnHistoryPurge)
{
- FilterStorage.resetHitCounts();
+ filterStorage.resetHitCounts();
FilterListener.setDirty(0); // Force saving to disk
Prefs.recentReports = [];
}
},
QueryInterface: XPCOMUtils.generateQI(
[Ci.nsISupportsWeakReference, Ci.nsIObserver]
)
@@ -113,17 +113,17 @@
filterNotifier.on("subscription.homepage", onGenericChange);
filterNotifier.on("subscription.downloadStatus", onGenericChange);
filterNotifier.on("subscription.lastCheck", onGenericChange);
filterNotifier.on("subscription.errors", onGenericChange);
filterNotifier.on("load", onLoad);
filterNotifier.on("save", onSave);
- FilterStorage.loadFromDisk();
+ filterStorage.loadFromDisk();
Services.obs.addObserver(HistoryPurgeObserver,
"browser:purge-session-history", true);
onShutdown.add(() =>
{
Services.obs.removeObserver(HistoryPurgeObserver,
"browser:purge-session-history");
});
@@ -257,31 +257,31 @@
if (!subscription.disabled)
subscription.filters.forEach(removeFilter);
}
function onSubscriptionDisabled(subscription, newValue)
{
FilterListener.setDirty(1);
- if (FilterStorage.knownSubscriptions.has(subscription.url))
+ if (filterStorage.knownSubscriptions.has(subscription.url))
{
if (newValue == false)
addFilters(subscription.filters);
else
subscription.filters.forEach(removeFilter);
}
}
function onSubscriptionUpdated(subscription, oldFilters)
{
FilterListener.setDirty(1);
if (!subscription.disabled &&
- FilterStorage.knownSubscriptions.has(subscription.url))
+ filterStorage.knownSubscriptions.has(subscription.url))
{
oldFilters.forEach(removeFilter);
addFilters(subscription.filters);
}
}
function onFilterHitCount(filter, newValue)
{
@@ -331,17 +331,17 @@
{
isDirty = 0;
defaultMatcher.clear();
ElemHide.clear();
ElemHideEmulation.clear();
ElemHideExceptions.clear();
Snippets.clear();
- for (let subscription of FilterStorage.subscriptions())
+ for (let subscription of filterStorage.subscriptions())
{
if (!subscription.disabled)
addFilters(subscription.filters);
}
}
function onSave()
{
« no previous file with comments | « no previous file | lib/filterStorage.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld