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

Side by Side Diff: lib/filterListener.js

Issue 29333245: Issue 3473 - patterns.ini is being saved on every filter hit after a while (Closed)
Patch Set: Created Jan. 6, 2016, 11:57 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 | « no previous file | no next file » | 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-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 * subsequent calls. If the parameter is 0 it forces saving filters if any 69 * subsequent calls. If the parameter is 0 it forces saving filters if any
70 * changes were recorded after the previous save. 70 * changes were recorded after the previous save.
71 */ 71 */
72 setDirty: function(/**Integer*/ factor) 72 setDirty: function(/**Integer*/ factor)
73 { 73 {
74 if (factor == 0 && isDirty > 0) 74 if (factor == 0 && isDirty > 0)
75 isDirty = 1; 75 isDirty = 1;
76 else 76 else
77 isDirty += factor; 77 isDirty += factor;
78 if (isDirty >= 1) 78 if (isDirty >= 1)
79 {
80 isDirty = 0;
79 FilterStorage.saveToDisk(); 81 FilterStorage.saveToDisk();
82 }
80 } 83 }
81 }; 84 };
82 85
83 /** 86 /**
84 * Observer listening to history purge actions. 87 * Observer listening to history purge actions.
85 * @class 88 * @class
86 */ 89 */
87 let HistoryPurgeObserver = 90 let HistoryPurgeObserver =
88 { 91 {
89 observe: function(subject, topic, data) 92 observe: function(subject, topic, data)
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 ElemHide.clear(); 281 ElemHide.clear();
279 CSSRules.clear(); 282 CSSRules.clear();
280 for (let subscription of FilterStorage.subscriptions) 283 for (let subscription of FilterStorage.subscriptions)
281 if (!subscription.disabled) 284 if (!subscription.disabled)
282 subscription.filters.forEach(addFilter); 285 subscription.filters.forEach(addFilter);
283 flushElemHide(); 286 flushElemHide();
284 } 287 }
285 else if (action == "save") 288 else if (action == "save")
286 isDirty = 0; 289 isDirty = 0;
287 } 290 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld