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

Delta Between Two Patch Sets: lib/filterListener.js

Issue 29935564: Issue 7452 - Do not cache element hiding filter objects by default Base URL: https://hg.adblockplus.org/adblockpluscore/
Left Patch Set: Rename filter* to filterText* Created Nov. 23, 2018, 2:01 a.m.
Right Patch Set: Rename filter* to filterText* Created April 8, 2019, 9:59 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « lib/filterClasses.js ('k') | test/elemHide.js » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 snippets.remove(filter); 215 snippets.remove(filter);
216 } 216 }
217 217
218 function onSubscriptionAdded(subscription) 218 function onSubscriptionAdded(subscription)
219 { 219 {
220 FilterListener.setDirty(1); 220 FilterListener.setDirty(1);
221 221
222 if (!subscription.disabled) 222 if (!subscription.disabled)
223 { 223 {
224 for (let text of subscription.filterText()) 224 for (let text of subscription.filterText())
225 addFilter(Filter.fromText(text), [subscription]); 225 addFilter(Filter.fromText(text, false), [subscription]);
226 } 226 }
227 } 227 }
228 228
229 function onSubscriptionRemoved(subscription) 229 function onSubscriptionRemoved(subscription)
230 { 230 {
231 FilterListener.setDirty(1); 231 FilterListener.setDirty(1);
232 232
233 if (!subscription.disabled) 233 if (!subscription.disabled)
234 { 234 {
235 for (let text of subscription.filterText()) 235 for (let text of subscription.filterText())
236 removeFilter(Filter.fromText(text)); 236 removeFilter(Filter.fromText(text, false));
237 } 237 }
238 } 238 }
239 239
240 function onSubscriptionDisabled(subscription, newValue) 240 function onSubscriptionDisabled(subscription, newValue)
241 { 241 {
242 FilterListener.setDirty(1); 242 FilterListener.setDirty(1);
243 243
244 if (filterStorage.knownSubscriptions.has(subscription.url)) 244 if (filterStorage.knownSubscriptions.has(subscription.url))
245 { 245 {
246 if (newValue == false) 246 if (newValue == false)
247 { 247 {
248 for (let text of subscription.filterText()) 248 for (let text of subscription.filterText())
249 addFilter(Filter.fromText(text), [subscription]); 249 addFilter(Filter.fromText(text, false), [subscription]);
250 } 250 }
251 else 251 else
252 { 252 {
253 for (let text of subscription.filterText()) 253 for (let text of subscription.filterText())
254 removeFilter(Filter.fromText(text)); 254 removeFilter(Filter.fromText(text, false));
255 } 255 }
256 } 256 }
257 } 257 }
258 258
259 function onSubscriptionUpdated(subscription, oldFilterText) 259 function onSubscriptionUpdated(subscription, oldFilterText)
260 { 260 {
261 FilterListener.setDirty(1); 261 FilterListener.setDirty(1);
262 262
263 if (!subscription.disabled && 263 if (!subscription.disabled &&
264 filterStorage.knownSubscriptions.has(subscription.url)) 264 filterStorage.knownSubscriptions.has(subscription.url))
265 { 265 {
266 for (let text of oldFilterText) 266 for (let text of oldFilterText)
267 removeFilter(Filter.fromText(text)); 267 removeFilter(Filter.fromText(text, false));
268 268
269 for (let text of subscription.filterText()) 269 for (let text of subscription.filterText())
270 addFilter(Filter.fromText(text), [subscription]); 270 addFilter(Filter.fromText(text, false), [subscription]);
271 } 271 }
272 } 272 }
273 273
274 function onFilterHitCount(filter, newValue) 274 function onFilterHitCount(filter, newValue)
275 { 275 {
276 if (newValue == 0) 276 if (newValue == 0)
277 FilterListener.setDirty(0); 277 FilterListener.setDirty(0);
278 else 278 else
279 FilterListener.setDirty(0.002); 279 FilterListener.setDirty(0.002);
280 } 280 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 ElemHide.clear(); 323 ElemHide.clear();
324 ElemHideEmulation.clear(); 324 ElemHideEmulation.clear();
325 ElemHideExceptions.clear(); 325 ElemHideExceptions.clear();
326 snippets.clear(); 326 snippets.clear();
327 327
328 for (let subscription of filterStorage.subscriptions()) 328 for (let subscription of filterStorage.subscriptions())
329 { 329 {
330 if (!subscription.disabled) 330 if (!subscription.disabled)
331 { 331 {
332 for (let text of subscription.filterText()) 332 for (let text of subscription.filterText())
333 addFilter(Filter.fromText(text), [subscription]); 333 addFilter(Filter.fromText(text, false), [subscription]);
334 } 334 }
335 } 335 }
336 } 336 }
337 337
338 function onSave() 338 function onSave()
339 { 339 {
340 isDirty = 0; 340 isDirty = 0;
341 } 341 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld