| LEFT | RIGHT | 
|---|
| 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 onFilterChangeTimeout = null; | 
|  | 23 function onFilterChange() | 
|  | 24 { | 
|  | 25   onFilterChangeTimeout = null; | 
|  | 26   chrome.webRequest.handlerBehaviorChanged(); | 
|  | 27 } | 
|  | 28 | 
| 22 var importantNotifications = { | 29 var importantNotifications = { | 
| 23   'filter.added': true, | 30   'filter.added': true, | 
| 24   'filter.removed': true, | 31   'filter.removed': true, | 
| 25   'filter.disabled': true, | 32   'filter.disabled': true, | 
| 26   'subscription.added': true, | 33   'subscription.added': true, | 
| 27   'subscription.removed': true, | 34   'subscription.removed': true, | 
| 28   'subscription.disabled': true, | 35   'subscription.disabled': true, | 
| 29   'subscription.updated': true, | 36   'subscription.updated': true, | 
| 30   'load': true | 37   'load': true | 
| 31 }; | 38 }; | 
|  | 39 | 
| 32 require("filterNotifier").FilterNotifier.addListener(function(action) | 40 require("filterNotifier").FilterNotifier.addListener(function(action) | 
| 33 { | 41 { | 
| 34   if (action in importantNotifications) | 42   if (action in importantNotifications) | 
| 35     chrome.webRequest.handlerBehaviorChanged(); | 43   { | 
|  | 44     // Execute delayed to prevent multiple executions in a quick succession | 
|  | 45     if (onFilterChangeTimeout != null) | 
|  | 46       window.clearTimeout(onFilterChangeTimeout); | 
|  | 47     onFilterChangeTimeout = window.setTimeout(onFilterChange, 2000); | 
|  | 48   } | 
| 36 }); | 49 }); | 
| 37 | 50 | 
| 38 var frames = {}; | 51 var frames = {}; | 
| 39 | 52 | 
| 40 function onBeforeRequest(details) | 53 function onBeforeRequest(details) | 
| 41 { | 54 { | 
| 42   if (details.tabId == -1) | 55   if (details.tabId == -1) | 
| 43     return {}; | 56     return {}; | 
| 44 | 57 | 
| 45   var type = details.type; | 58   var type = details.type; | 
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 186   { | 199   { | 
| 187     var parentUrl = getFrameUrl(tabId, parent); | 200     var parentUrl = getFrameUrl(tabId, parent); | 
| 188     if (parentUrl && isWhitelisted(parentUrl, type)) | 201     if (parentUrl && isWhitelisted(parentUrl, type)) | 
| 189       return true; | 202       return true; | 
| 190     if (parentUrl && "keyException" in frames[tabId][frameId]) | 203     if (parentUrl && "keyException" in frames[tabId][frameId]) | 
| 191       return true; | 204       return true; | 
| 192     parent = getFrameParent(tabId, parent); | 205     parent = getFrameParent(tabId, parent); | 
| 193   } | 206   } | 
| 194   return false; | 207   return false; | 
| 195 } | 208 } | 
| LEFT | RIGHT | 
|---|