Add isActiveFilter() function
Background
This is a step towards #19.
The main use of instanceof
on a filter object is when checking if it's an active filter. We could instead provide a utility function that encapsulates this.
function isActiveFilter(filter)
{
return filter instanceof ActiveFilter;
}
What to change
Add the function isActiveFilter()
to lib/filterClasses.js
. It should be called from lib/filterListener.js
, lib/filterStorage.js
, lib/matcher.js
, and lib/subscriptionClasses.js
in lieu of instanceof ActiveFilter
.
Integration notes
eyeo/adblockplus/adblockpluschrome>: Use isActiveFilter()
instead of instanceof ActiveFilter
in lib/filterConfiguration.js
.
eyeo/adblockplus/abpui/adblockplusui>: Use isActiveFilter()
instead of instanceof ActiveFilter
in lib/antiadblockInit.js
and mocks/*.js
.
Hints for testers
The changes are straightforward and covered by tests so there should be no need for any specific testing beyond what is already mentioned in #159 (closed).