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

Unified Diff: webrequest.js

Issue 11627039: Added ad counting functionality (Closed)
Patch Set: Created Sept. 11, 2013, 3:10 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« stats.js ('K') | « stats.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrequest.js
===================================================================
--- a/webrequest.js
+++ b/webrequest.js
@@ -15,6 +15,8 @@
* along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
*/
+var FilterNotifier = require("filterNotifier").FilterNotifier;
+
chrome.webRequest.onBeforeRequest.addListener(onBeforeRequest, {urls: ["http://*/*", "https://*/*"]}, ["blocking"]);
chrome.webRequest.onHeadersReceived.addListener(onHeadersReceived, {urls: ["http://*/*", "https://*/*"]}, ["responseHeaders"]);
chrome.tabs.onRemoved.addListener(forgetTab);
@@ -37,7 +39,7 @@
'load': true
};
-require("filterNotifier").FilterNotifier.addListener(function(action)
+FilterNotifier.addListener(function(action)
{
if (action in importantNotifications)
{
@@ -70,6 +72,7 @@
var frame = (type != "SUBDOCUMENT" ? details.frameId : details.parentFrameId);
var filter = checkRequest(type, details.tabId, details.url, frame);
+ FilterNotifier.triggerListeners("document.stats", filter, 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
if (filter instanceof BlockingFilter)
return {cancel: true};
else
« stats.js ('K') | « stats.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld