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

Unified Diff: messageResponder.js

Issue 29907592: Issue 7027 - User FilterStorage.knownSubscriptions in messageResponder.js (Closed) Base URL: https://hg.adblockplus.org/adblockplusui/
Patch Set: Created Oct. 12, 2018, 4:57 a.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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: messageResponder.js
===================================================================
--- a/messageResponder.js
+++ b/messageResponder.js
@@ -306,17 +306,17 @@
{
FilterStorage.addFilter(filter);
seenFilter[filter.text] = null;
}
if (!message.removeExisting)
return errors;
- for (const subscription of FilterStorage.subscriptions)
+ for (const subscription of FilterStorage.knownSubscriptions.values())
{
if (!(subscription instanceof SpecialSubscription))
continue;
for (let j = subscription.filters.length - 1; j >= 0; j--)
{
const filter = subscription.filters[j];
if (/^@@\|\|([^/:]+)\^\$document$/.test(filter.text))
@@ -401,26 +401,27 @@
else
{
addSubscription(subscription, message);
}
});
port.on("subscriptions.get", (message, sender) =>
{
- const subscriptions = FilterStorage.subscriptions.filter((s) =>
- {
- if (message.ignoreDisabled && s.disabled)
+ const subscriptions = [
+ ...FilterStorage.knownSubscriptions.values()].filter((s) =>
+ {
+ if (message.ignoreDisabled && s.disabled)
+ return false;
+ if (s instanceof DownloadableSubscription && message.downloadable)
+ return true;
+ if (s instanceof SpecialSubscription && message.special)
+ return true;
return false;
- if (s instanceof DownloadableSubscription && message.downloadable)
- return true;
- if (s instanceof SpecialSubscription && message.special)
- return true;
- return false;
- });
+ });
return subscriptions.map((s) =>
{
const result = convertSubscription(s);
if (message.disabledFilters)
{
result.disabledFilters = s.filters
.filter((f) => f instanceof ActiveFilter && f.disabled)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld