Index: lib/subscriptionClasses.js |
=================================================================== |
--- a/lib/subscriptionClasses.js |
+++ b/lib/subscriptionClasses.js |
@@ -16,17 +16,17 @@ |
*/ |
"use strict"; |
/** |
* @fileOverview Definition of Subscription class and its subclasses. |
*/ |
-const {ActiveFilter, BlockingFilter, |
+const {Filter, ActiveFilter, BlockingFilter, |
WhitelistFilter, ElemHideBase} = require("./filterClasses"); |
const {filterNotifier} = require("./filterNotifier"); |
const {extend} = require("./coreUtils"); |
/** |
* Abstract base class for filter subscriptions |
* |
* @param {string} url download location of the subscription |
@@ -163,27 +163,30 @@ |
}, |
/** |
* Yields the {@link Filter} object for each filter in the subscription. |
* @yields {Filter} |
*/ |
*filters() |
{ |
- yield* this._filters; |
+ for (let i = 0; i < this._filters.length; i++) |
+ yield this._filters[i] || Filter.fromText(this._filterText[i], false); |
}, |
/** |
* Returns the {@link Filter} object at the given 0-based index. |
* @param {number} index |
* @returns {?Filter} |
*/ |
filterAt(index) |
{ |
- return this._filters[index] || null; |
+ return this._filters[index] || |
+ (index >= 0 && index < this._filters.length ? |
+ Filter.fromText(this._filterText[index], false) : null); |
}, |
/** |
* Returns the 0-based index of the given filter. |
* @param {Filter} filter |
* @param {number} [fromIndex] The index from which to start the search. |
* @return {number} |
*/ |
@@ -259,16 +262,22 @@ |
}, |
/** |
* Clears any in-memory caches held by the object. |
* @package |
*/ |
clearCaches() |
{ |
+ for (let i = 0; i < this._filters.length; i++) |
+ { |
+ if (this._filters[i] && this._filters[i].ephemeral) |
+ this._filters[i] = null; |
+ } |
+ |
this._filterTextLookup = null; |
}, |
/** |
* Serializes the subscription for writing out on disk. |
* @yields {string} |
*/ |
*serialize() |