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

Unified Diff: lib/subscriptionClasses.js

Issue 29934588: Issue 7094 - Encapsulate management of subscription filters (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created Nov. 2, 2018, 10:34 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 | « lib/iniParser.js ('k') | lib/synchronizer.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/subscriptionClasses.js
===================================================================
--- a/lib/subscriptionClasses.js
+++ b/lib/subscriptionClasses.js
@@ -54,20 +54,29 @@
/**
* Type of the subscription
* @type {?string}
*/
type: null,
/**
* Filters contained in the filter subscription
- * @type {Filter[]}
+ * @type {Array.<string>}
*/
filters: null,
+ /**
+ * A list of {@link Filter} objects associated with the subscription in some
+ * way. This is used by {@link INIParser} to temporarily cache objects
+ * corresponding to the subscription's filter text.
+ * @type {?Array.<Filter>}
+ * @package
+ */
+ filterObjects: null,
+
_title: null,
_fixedTitle: false,
_disabled: false,
/**
* Title of the filter subscription
* @type {string}
*/
@@ -146,18 +155,18 @@
},
*serializeFilters()
{
let {filters} = this;
yield "[Subscription filters]";
- for (let filter of filters)
- yield filter.text.replace(/\[/g, "\\[");
+ for (let text of filters)
+ yield text.replace(/\[/g, "\\[");
},
toString()
{
return [...this.serialize()].join("\n");
}
};
@@ -328,17 +337,17 @@
* Creates a new user-defined filter group and adds the given filter to it.
* This group will act as the default group for this filter type.
* @param {Filter} filter
* @return {SpecialSubscription}
*/
SpecialSubscription.createForFilter = function(filter)
{
let subscription = SpecialSubscription.create();
- subscription.filters.push(filter);
+ subscription.filters.push(filter.text);
for (let [type, class_] of SpecialSubscription.defaultsMap)
{
if (filter instanceof class_)
subscription.defaults = [type];
}
if (!subscription.defaults)
subscription.defaults = ["blocking"];
return subscription;
« no previous file with comments | « lib/iniParser.js ('k') | lib/synchronizer.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld