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-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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 * @return {Object} An object containing properties allow, collapse and hits | 118 * @return {Object} An object containing properties allow, collapse and hits |
119 * indicating how this request should be handled. | 119 * indicating how this request should be handled. |
120 */ | 120 */ |
121 shouldAllow: function({contentType, location, frames, isPrivate}) | 121 shouldAllow: function({contentType, location, frames, isPrivate}) |
122 { | 122 { |
123 let hits = []; | 123 let hits = []; |
124 | 124 |
125 function addHit(frameIndex, contentType, docDomain, thirdParty, location, fi
lter) | 125 function addHit(frameIndex, contentType, docDomain, thirdParty, location, fi
lter) |
126 { | 126 { |
127 if (filter && !isPrivate) | 127 if (filter && !isPrivate) |
128 FilterStorage.increaseHitCount(filter); | 128 FilterStorage.increaseHitCount(filter, docDomain, thirdParty); |
| 129 |
129 hits.push({ | 130 hits.push({ |
130 frameIndex, contentType, docDomain, thirdParty, location, | 131 frameIndex, contentType, docDomain, thirdParty, location, |
131 filter: filter ? filter.text : null, | 132 filter: filter ? filter.text : null, |
132 filterType: filter ? filter.type : null | 133 filterType: filter ? filter.type : null |
133 }); | 134 }); |
134 } | 135 } |
135 | 136 |
136 function response(allow, collapse) | 137 function response(allow, collapse) |
137 { | 138 { |
138 return {allow, collapse, hits}; | 139 return {allow, collapse, hits}; |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 { | 424 { |
424 // EffectiveTLDService throws on IP addresses, just compare the host name | 425 // EffectiveTLDService throws on IP addresses, just compare the host name |
425 let host = ""; | 426 let host = ""; |
426 try | 427 try |
427 { | 428 { |
428 host = uri.host; | 429 host = uri.host; |
429 } catch (e) {} | 430 } catch (e) {} |
430 return host != docDomain; | 431 return host != docDomain; |
431 } | 432 } |
432 } | 433 } |
OLD | NEW |