 Issue 6337686776315904:
  Issue 394 - hit statistics tool data collection  (Closed)
    
  
    Issue 6337686776315904:
  Issue 394 - hit statistics tool data collection  (Closed) 
  | Left: | ||
| Right: | 
| OLD | NEW | 
|---|---|
| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 101 * @return {Object} An object containing properties allow, collapse and hits | 101 * @return {Object} An object containing properties allow, collapse and hits | 
| 102 * indicating how this request should be handled. | 102 * indicating how this request should be handled. | 
| 103 */ | 103 */ | 
| 104 shouldAllow: function({contentType, location, frames, isPrivate}) | 104 shouldAllow: function({contentType, location, frames, isPrivate}) | 
| 105 { | 105 { | 
| 106 let hits = []; | 106 let hits = []; | 
| 107 | 107 | 
| 108 function addHit(frameIndex, contentType, docDomain, thirdParty, location, fi lter) | 108 function addHit(frameIndex, contentType, docDomain, thirdParty, location, fi lter) | 
| 109 { | 109 { | 
| 110 if (filter && !isPrivate) | 110 if (filter && !isPrivate) | 
| 111 FilterStorage.increaseHitCount(filter); | 111 { | 
| 112 let topWindowLocation = frames[frames.length-1].location; | |
| 113 FilterStorage.increaseHitCount(filter, getHostname(topWindowLocation)); | |
| 
Wladimir Palant
2016/02/15 12:25:40
getHostname(topWindowLocation) should be identical
 
saroyanm
2016/02/19 17:38:11
Done.
 | |
| 114 } | |
| 112 hits.push({ | 115 hits.push({ | 
| 113 frameIndex, contentType, docDomain, thirdParty, location, | 116 frameIndex, contentType, docDomain, thirdParty, location, | 
| 114 filter: filter ? filter.text : null, | 117 filter: filter ? filter.text : null, | 
| 115 filterType: filter ? filter.type : null | 118 filterType: filter ? filter.type : null | 
| 116 }); | 119 }); | 
| 117 } | 120 } | 
| 118 | 121 | 
| 119 function response(allow, collapse) | 122 function response(allow, collapse) | 
| 120 { | 123 { | 
| 121 return {allow, collapse, hits}; | 124 return {allow, collapse, hits}; | 
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 395 { | 398 { | 
| 396 // EffectiveTLDService throws on IP addresses, just compare the host name | 399 // EffectiveTLDService throws on IP addresses, just compare the host name | 
| 397 let host = ""; | 400 let host = ""; | 
| 398 try | 401 try | 
| 399 { | 402 { | 
| 400 host = uri.host; | 403 host = uri.host; | 
| 401 } catch (e) {} | 404 } catch (e) {} | 
| 402 return host != docDomain; | 405 return host != docDomain; | 
| 403 } | 406 } | 
| 404 } | 407 } | 
| OLD | NEW |