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

Unified Diff: lib/filterClasses.js

Issue 30013628: Issue 7029 - Remove subscriptions property of Filter object (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created Feb. 24, 2019, 1:30 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/filterListener.js » ('j') | lib/filterListener.js » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/filterClasses.js
===================================================================
--- a/lib/filterClasses.js
+++ b/lib/filterClasses.js
@@ -102,91 +102,16 @@
* @type {string}
*/
get type()
{
throw new Error("Please define filter type in the subclass");
},
/**
- * Yields subscriptions to which the filter belongs.
- * @yields {Subscription}
- */
- *subscriptions()
- {
- if (this._subscriptions)
- {
- if (this._subscriptions instanceof Set)
- yield* this._subscriptions;
- else
- yield this._subscriptions;
- }
- },
-
- /**
- * The number of subscriptions to which the filter belongs.
- * @type {number}
- */
- get subscriptionCount()
- {
- if (this._subscriptions instanceof Set)
- return this._subscriptions.size;
-
- return this._subscriptions ? 1 : 0;
- },
-
- /**
- * Adds a subscription to the set of subscriptions to which the filter
- * belongs.
- * @param {Subscription} subscription
- */
- addSubscription(subscription)
- {
- // Since we use truthy checks in our logic, we must avoid adding a
- // subscription that isn't a non-null object.
- if (subscription === null || typeof subscription != "object")
- return;
-
- if (this._subscriptions)
- {
- if (this._subscriptions instanceof Set)
- this._subscriptions.add(subscription);
- else if (subscription != this._subscriptions)
- this._subscriptions = new Set([this._subscriptions, subscription]);
- }
- else
- {
- this._subscriptions = subscription;
- }
- },
-
- /**
- * Removes a subscription from the set of subscriptions to which the filter
- * belongs.
- * @param {Subscription} subscription
- */
- removeSubscription(subscription)
- {
- if (this._subscriptions)
- {
- if (this._subscriptions instanceof Set)
- {
- this._subscriptions.delete(subscription);
-
- if (this._subscriptions.size == 1)
- this._subscriptions = [...this._subscriptions][0];
- }
- else if (subscription == this._subscriptions)
- {
- this._subscriptions = null;
- }
- }
- },
-
- /**
* Serializes the filter for writing out on disk.
* @yields {string}
*/
*serialize()
{
let {text} = this;
yield "[Filter]";
« no previous file with comments | « no previous file | lib/filterListener.js » ('j') | lib/filterListener.js » ('J')

Powered by Google App Engine
This is Rietveld