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

Side by Side Diff: lib/contentPolicy.js

Issue 6337686776315904: Issue 394 - hit statistics tool data collection (Closed)
Patch Set: Addressed Wladimir comments (save data in the database instead of memory) Created Feb. 19, 2016, 5:20 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
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-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 * @return {Object} An object containing properties allow, collapse and hits 117 * @return {Object} An object containing properties allow, collapse and hits
118 * indicating how this request should be handled. 118 * indicating how this request should be handled.
119 */ 119 */
120 shouldAllow: function({contentType, location, frames, isPrivate}) 120 shouldAllow: function({contentType, location, frames, isPrivate})
121 { 121 {
122 let hits = []; 122 let hits = [];
123 123
124 function addHit(frameIndex, contentType, docDomain, thirdParty, location, fi lter) 124 function addHit(frameIndex, contentType, docDomain, thirdParty, location, fi lter)
125 { 125 {
126 if (filter && !isPrivate) 126 if (filter && !isPrivate)
127 FilterStorage.increaseHitCount(filter); 127 FilterStorage.increaseHitCount(filter, docDomain);
128
128 hits.push({ 129 hits.push({
129 frameIndex, contentType, docDomain, thirdParty, location, 130 frameIndex, contentType, docDomain, thirdParty, location,
130 filter: filter ? filter.text : null, 131 filter: filter ? filter.text : null,
131 filterType: filter ? filter.type : null 132 filterType: filter ? filter.type : null
132 }); 133 });
133 } 134 }
134 135
135 function response(allow, collapse) 136 function response(allow, collapse)
136 { 137 {
137 return {allow, collapse, hits}; 138 return {allow, collapse, hits};
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 { 401 {
401 // EffectiveTLDService throws on IP addresses, just compare the host name 402 // EffectiveTLDService throws on IP addresses, just compare the host name
402 let host = ""; 403 let host = "";
403 try 404 try
404 { 405 {
405 host = uri.host; 406 host = uri.host;
406 } catch (e) {} 407 } catch (e) {}
407 return host != docDomain; 408 return host != docDomain;
408 } 409 }
409 } 410 }
OLDNEW

Powered by Google App Engine
This is Rietveld