 Issue 11627039:
  Added ad counting functionality  (Closed)
    
  
    Issue 11627039:
  Added ad counting functionality  (Closed) 
  | Left: | ||
| Right: | 
| LEFT | RIGHT | 
|---|---|
| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 65 return {}; | 65 return {}; | 
| 66 | 66 | 
| 67 // Type names match Mozilla's with main_frame and sub_frame being the only exc eptions. | 67 // Type names match Mozilla's with main_frame and sub_frame being the only exc eptions. | 
| 68 if (type == "sub_frame") | 68 if (type == "sub_frame") | 
| 69 type = "SUBDOCUMENT"; | 69 type = "SUBDOCUMENT"; | 
| 70 else | 70 else | 
| 71 type = type.toUpperCase(); | 71 type = type.toUpperCase(); | 
| 72 | 72 | 
| 73 var frame = (type != "SUBDOCUMENT" ? details.frameId : details.parentFrameId); | 73 var frame = (type != "SUBDOCUMENT" ? details.frameId : details.parentFrameId); | 
| 74 var filter = checkRequest(type, details.tabId, details.url, frame); | 74 var filter = checkRequest(type, details.tabId, details.url, frame); | 
| 75 FilterNotifier.triggerListeners("document.stats", filter, details.tabId); | 75 FilterNotifier.triggerListeners("filter.hitCount", filter, 0, 0, details.tabId ); | 
| 
Wladimir Palant
2013/09/18 09:44:41
The usual notification is "filter.hitCount". This
 
Thomas Greiner
2013/09/19 09:42:29
I thought about it before but the arguments differ
 
Wladimir Palant
2013/09/19 10:56:22
I guess we can introduce an additional application
 | |
| 76 if (filter instanceof BlockingFilter) | 76 if (filter instanceof BlockingFilter) | 
| 77 return {cancel: true}; | 77 return {cancel: true}; | 
| 78 else | 78 else | 
| 79 return {}; | 79 return {}; | 
| 80 } | 80 } | 
| 81 | 81 | 
| 82 function onHeadersReceived(details) | 82 function onHeadersReceived(details) | 
| 83 { | 83 { | 
| 84 if (details.tabId == -1) | 84 if (details.tabId == -1) | 
| 85 return; | 85 return; | 
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 193 parent = frameData.parent; | 193 parent = frameData.parent; | 
| 194 parentData = getFrameData(tabId, parent); | 194 parentData = getFrameData(tabId, parent); | 
| 195 | 195 | 
| 196 var frameUrl = frameData.url; | 196 var frameUrl = frameData.url; | 
| 197 var parentUrl = (parentData ? parentData.url : frameUrl); | 197 var parentUrl = (parentData ? parentData.url : frameUrl); | 
| 198 if ("keyException" in frameData || isWhitelisted(frameUrl, parentUrl, type)) | 198 if ("keyException" in frameData || isWhitelisted(frameUrl, parentUrl, type)) | 
| 199 return true; | 199 return true; | 
| 200 } | 200 } | 
| 201 return false; | 201 return false; | 
| 202 } | 202 } | 
| LEFT | RIGHT |