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

Side by Side Diff: webrequest.js

Issue 6393086494113792: Issue 154 - Added devtools panel showing blocked and blockable items (Closed)
Patch Set: Rebased and fixed documentation mistakenly indicating arguments as optional Created Feb. 28, 2015, 5:52 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
« no previous file with comments | « popupBlocker.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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-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
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 var FilterNotifier = require("filterNotifier").FilterNotifier; 18 var FilterNotifier = require("filterNotifier").FilterNotifier;
19 var RegExpFilter = require("filterClasses").RegExpFilter; 19 var RegExpFilter = require("filterClasses").RegExpFilter;
20 var platform = require("info").platform; 20 var platform = require("info").platform;
21 var logRequest = require("devtools").logRequest;
21 22
22 var onFilterChangeTimeout = null; 23 var onFilterChangeTimeout = null;
23 function onFilterChange() 24 function onFilterChange()
24 { 25 {
25 onFilterChangeTimeout = null; 26 onFilterChangeTimeout = null;
26 ext.webRequest.handlerBehaviorChanged(); 27 ext.webRequest.handlerBehaviorChanged();
27 } 28 }
28 29
29 var importantNotifications = { 30 var importantNotifications = {
30 'filter.added': true, 31 'filter.added': true,
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 71
71 // We can't listen to onHeadersReceived in Safari so we need to 72 // We can't listen to onHeadersReceived in Safari so we need to
72 // check for notifications here 73 // check for notifications here
73 if (platform != "chromium" && type == "SUBDOCUMENT") 74 if (platform != "chromium" && type == "SUBDOCUMENT")
74 { 75 {
75 var notificationToShow = NotificationStorage.getNextToShow(stringifyURL(url) ); 76 var notificationToShow = NotificationStorage.getNextToShow(stringifyURL(url) );
76 if (notificationToShow) 77 if (notificationToShow)
77 showNotification(notificationToShow); 78 showNotification(notificationToShow);
78 } 79 }
79 80
81 logRequest(page, url, type, docDomain, key, filter);
80 FilterNotifier.triggerListeners("filter.hitCount", filter, 0, 0, page); 82 FilterNotifier.triggerListeners("filter.hitCount", filter, 0, 0, page);
83
81 return !(filter instanceof BlockingFilter); 84 return !(filter instanceof BlockingFilter);
82 } 85 }
83 86
84 ext.webRequest.onBeforeRequest.addListener(onBeforeRequest); 87 ext.webRequest.onBeforeRequest.addListener(onBeforeRequest);
85 88
86 if (platform == "chromium") 89 if (platform == "chromium")
87 { 90 {
88 function onHeadersReceived(details) 91 function onHeadersReceived(details)
89 { 92 {
90 if (details.tabId == -1) 93 if (details.tabId == -1)
(...skipping 15 matching lines...) Expand all
106 processKey(header.value, page, frame); 109 processKey(header.value, page, frame);
107 } 110 }
108 111
109 var notificationToShow = NotificationStorage.getNextToShow(stringifyURL(new URL(details.url))); 112 var notificationToShow = NotificationStorage.getNextToShow(stringifyURL(new URL(details.url)));
110 if (notificationToShow) 113 if (notificationToShow)
111 showNotification(notificationToShow); 114 showNotification(notificationToShow);
112 } 115 }
113 116
114 chrome.webRequest.onHeadersReceived.addListener(onHeadersReceived, {urls: ["ht tp://*/*", "https://*/*"]}, ["responseHeaders"]); 117 chrome.webRequest.onHeadersReceived.addListener(onHeadersReceived, {urls: ["ht tp://*/*", "https://*/*"]}, ["responseHeaders"]);
115 } 118 }
OLDNEW
« no previous file with comments | « popupBlocker.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld