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

Side by Side Diff: webrequest.js

Issue 8691076: Make sure to indicate to Chrome when our filters change (Closed)
Patch Set: Created Oct. 29, 2012, noon
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 | « no previous file | 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 the Adblock Plus extension, 2 * This file is part of the Adblock Plus extension,
3 * Copyright (C) 2006-2012 Eyeo GmbH 3 * Copyright (C) 2006-2012 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 chrome.webRequest.onBeforeRequest.addListener(onBeforeRequest, {urls: ["http://* /*", "https://*/*"]}, ["blocking"]); 18 chrome.webRequest.onBeforeRequest.addListener(onBeforeRequest, {urls: ["http://* /*", "https://*/*"]}, ["blocking"]);
19 chrome.webRequest.onHeadersReceived.addListener(onHeadersReceived, {urls: ["http ://*/*", "https://*/*"]}, ["responseHeaders"]); 19 chrome.webRequest.onHeadersReceived.addListener(onHeadersReceived, {urls: ["http ://*/*", "https://*/*"]}, ["responseHeaders"]);
20 chrome.tabs.onRemoved.addListener(forgetTab); 20 chrome.tabs.onRemoved.addListener(forgetTab);
21 21
22 var importantNotifications = {
23 'filter.added': true,
24 'filter.removed': true,
25 'filter.disabled': true,
26 'subscription.added': true,
27 'subscription.removed': true,
28 'subscription.disabled': true,
29 'subscription.updated': true,
30 'load': true
31 };
32 require("filterNotifier").FilterNotifier.addListener(function(action)
33 {
34 if (action in importantNotifications)
35 chrome.webRequest.handlerBehaviorChanged();
Thomas Greiner 2012/10/29 16:40:16 according to the docs we shouldn't call it too oft
36 });
37
22 var frames = {}; 38 var frames = {};
23 39
24 function onBeforeRequest(details) 40 function onBeforeRequest(details)
25 { 41 {
26 if (details.tabId == -1) 42 if (details.tabId == -1)
27 return {}; 43 return {};
28 44
29 var type = details.type; 45 var type = details.type;
30 if (type == "main_frame" || type == "sub_frame") 46 if (type == "main_frame" || type == "sub_frame")
31 recordFrame(details.tabId, details.frameId, details.parentFrameId, details.u rl); 47 recordFrame(details.tabId, details.frameId, details.parentFrameId, details.u rl);
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 { 186 {
171 var parentUrl = getFrameUrl(tabId, parent); 187 var parentUrl = getFrameUrl(tabId, parent);
172 if (parentUrl && isWhitelisted(parentUrl, type)) 188 if (parentUrl && isWhitelisted(parentUrl, type))
173 return true; 189 return true;
174 if (parentUrl && "keyException" in frames[tabId][frameId]) 190 if (parentUrl && "keyException" in frames[tabId][frameId])
175 return true; 191 return true;
176 parent = getFrameParent(tabId, parent); 192 parent = getFrameParent(tabId, parent);
177 } 193 }
178 return false; 194 return false;
179 } 195 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld