Index: messageResponder.js |
=================================================================== |
--- a/messageResponder.js |
+++ b/messageResponder.js |
@@ -24,7 +24,6 @@ |
var FilterStorage = require("filterStorage").FilterStorage; |
var FilterNotifier = require("filterNotifier").FilterNotifier; |
var defaultMatcher = require("matcher").defaultMatcher; |
- var BlockingFilter = require("filterClasses").BlockingFilter; |
var Synchronizer = require("synchronizer").Synchronizer; |
var subscriptionClasses = require("subscriptionClasses"); |
@@ -32,6 +31,13 @@ |
var DownloadableSubscription = subscriptionClasses.DownloadableSubscription; |
var SpecialSubscription = subscriptionClasses.SpecialSubscription; |
+ var filterClasses = require("filterClasses"); |
+ var Filter = filterClasses.Filter; |
+ var BlockingFilter = filterClasses.BlockingFilter; |
+ |
+ var devtools = require("devtools"); |
+ var initDevToolsPanel = devtools ? devtools.initDevToolsPanel : function() {}; |
+ |
var subscriptionKeys = ["disabled", "homepage", "lastSuccess", "title", "url", "downloadStatus"]; |
function convertSubscription(subscription) |
{ |
@@ -139,6 +145,12 @@ |
var filter = defaultMatcher.matchesAny(message.url, message.requestType, message.docDomain, message.thirdParty); |
callback(filter instanceof BlockingFilter); |
break; |
+ case "filters.add": |
+ FilterStorage.addFilter(Filter.fromText(message.filter)); |
+ break; |
+ case "filters.remove": |
+ FilterStorage.removeFilter(Filter.fromText(message.filter)); |
+ break; |
case "subscriptions.toggle": |
var subscription = Subscription.fromURL(message.url); |
if (subscription.url in FilterStorage.knownSubscriptions && !subscription.disabled) |
@@ -172,6 +184,9 @@ |
else |
delete filters.subscription; |
break; |
+ case "devtools.init": |
+ initDevToolsPanel(sender.page, message.inspectedTabId); |
+ break; |
} |
}); |
})(this); |