Index: webrequest.js |
=================================================================== |
--- a/webrequest.js |
+++ b/webrequest.js |
@@ -14,16 +14,45 @@ |
* You should have received a copy of the GNU General Public License |
* along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
*/ |
chrome.webRequest.onBeforeRequest.addListener(onBeforeRequest, {urls: ["http://*/*", "https://*/*"]}, ["blocking"]); |
chrome.webRequest.onHeadersReceived.addListener(onHeadersReceived, {urls: ["http://*/*", "https://*/*"]}, ["responseHeaders"]); |
chrome.tabs.onRemoved.addListener(forgetTab); |
+var onFilterChangeTimeout = null; |
+function onFilterChange() |
+{ |
+ onFilterChangeTimeout = null; |
+ chrome.webRequest.handlerBehaviorChanged(); |
+} |
+ |
+var importantNotifications = { |
+ 'filter.added': true, |
+ 'filter.removed': true, |
+ 'filter.disabled': true, |
+ 'subscription.added': true, |
+ 'subscription.removed': true, |
+ 'subscription.disabled': true, |
+ 'subscription.updated': true, |
+ 'load': true |
+}; |
+ |
+require("filterNotifier").FilterNotifier.addListener(function(action) |
+{ |
+ if (action in importantNotifications) |
+ { |
+ // Execute delayed to prevent multiple executions in a quick succession |
+ if (onFilterChangeTimeout != null) |
+ window.clearTimeout(onFilterChangeTimeout); |
+ window.setTimeout(onFilterChange, 2000); |
Thomas Greiner
2012/10/30 10:17:22
set onFilterChangeTimeout variable
otherwise it wi
|
+ } |
+}); |
+ |
var frames = {}; |
function onBeforeRequest(details) |
{ |
if (details.tabId == -1) |
return {}; |
var type = details.type; |