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

Side by Side Diff: lib/filterListener.js

Issue 29790555: Issue 6671 - Introduce trusted subscriptions (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Make user's own filters trusted Created May 25, 2018, 6:41 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/filterClasses.js ('k') | lib/subscriptionClasses.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH 3 * Copyright (C) 2006-present eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 139
140 let hasEnabled = false; 140 let hasEnabled = false;
141 for (let i = 0; i < filter.subscriptions.length; i++) 141 for (let i = 0; i < filter.subscriptions.length; i++)
142 { 142 {
143 if (!filter.subscriptions[i].disabled) 143 if (!filter.subscriptions[i].disabled)
144 hasEnabled = true; 144 hasEnabled = true;
145 } 145 }
146 if (!hasEnabled) 146 if (!hasEnabled)
147 return; 147 return;
148 148
149 if (filter.needsTrust)
150 {
151 let hasTrust = false;
152 for (let i = 0; i < filter.subscriptions.length; i++)
153 {
154 if (filter.subscriptions[i].trusted)
155 {
156 hasTrust = true;
157 break;
158 }
159 }
160 if (!hasTrust)
161 return;
162 }
163
149 if (filter instanceof RegExpFilter) 164 if (filter instanceof RegExpFilter)
150 defaultMatcher.add(filter); 165 defaultMatcher.add(filter);
151 else if (filter instanceof ElemHideBase) 166 else if (filter instanceof ElemHideBase)
152 { 167 {
153 if (filter instanceof ElemHideEmulationFilter) 168 if (filter instanceof ElemHideEmulationFilter)
154 ElemHideEmulation.add(filter); 169 ElemHideEmulation.add(filter);
155 else 170 else
156 ElemHide.add(filter); 171 ElemHide.add(filter);
157 } 172 }
158 } 173 }
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 { 326 {
312 if (!subscription.disabled) 327 if (!subscription.disabled)
313 addFilters(subscription.filters); 328 addFilters(subscription.filters);
314 } 329 }
315 } 330 }
316 331
317 function onSave() 332 function onSave()
318 { 333 {
319 isDirty = 0; 334 isDirty = 0;
320 } 335 }
OLDNEW
« no previous file with comments | « lib/filterClasses.js ('k') | lib/subscriptionClasses.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld