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

Side by Side Diff: lib/stats.js

Issue 12326007: Fixed: Total blocked count was not saved across multiple sessions (Closed)
Patch Set: Created Oct. 2, 2013, 8:20 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 <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2013 Eyeo GmbH 3 * Copyright (C) 2006-2013 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 27 matching lines...) Expand all
38 } 38 }
39 else 39 else
40 return (key in Prefs.stats_total ? Prefs.stats_total[key] : 0); 40 return (key in Prefs.stats_total ? Prefs.stats_total[key] : 0);
41 }; 41 };
42 42
43 FilterNotifier.addListener(function(action, item, newValue, oldValue, tabId) 43 FilterNotifier.addListener(function(action, item, newValue, oldValue, tabId)
44 { 44 {
45 if (action != "filter.hitCount") 45 if (action != "filter.hitCount")
46 return; 46 return;
47 47
48 var blocked = item instanceof BlockingFilter; 48 let statsTotal = Prefs.stats_total;
49 49
50 // Increment counts 50 // Increment counts
51 if (blocked) 51 if (item instanceof BlockingFilter)
52 { 52 {
53 if ("blocked" in Prefs.stats_total) 53 if ("blocked" in statsTotal)
54 Prefs.stats_total.blocked++; 54 statsTotal.blocked++;
55 else 55 else
56 Prefs.stats_total.blocked = 1; 56 statsTotal.blocked = 1;
Wladimir Palant 2013/10/02 09:26:26 Adding Prefs.stats_total = Prefs.stats_total; here
57 57
58 let frameData = getFrameData(tabId, 0); 58 let frameData = getFrameData(tabId, 0);
59 if (frameData) 59 if (frameData)
60 { 60 {
61 if ("blocked" in frameData) 61 if ("blocked" in frameData)
62 frameData.blocked++; 62 frameData.blocked++;
63 else 63 else
64 frameData.blocked = 1; 64 frameData.blocked = 1;
65 } 65 }
66 } 66 }
67
68 Prefs.stats_total = statsTotal;
67 }); 69 });
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