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

Unified Diff: messageResponder.js

Issue 29522650: Issue 5316 - Adds dynamic filter types to devtools panel (Closed)
Patch Set: Created Aug. 21, 2017, 3:24 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: messageResponder.js
===================================================================
--- a/messageResponder.js
+++ b/messageResponder.js
@@ -35,16 +35,20 @@
const {Filter, BlockingFilter, RegExpFilter} = require("filterClasses");
const {Synchronizer} = require("synchronizer");
const info = require("info");
const {Subscription,
DownloadableSubscription,
SpecialSubscription} = require("subscriptionClasses");
+ // Some resource types are not available on Chrome
Jon Sonesen 2017/08/21 15:31:07 This comment probably needs to be improved
Thomas Greiner 2017/08/22 11:21:47 Indeed… what are you trying to express here?
Jon Sonesen 2017/08/24 11:29:06 Yeah I dunno, I thought it would make sense to exp
Thomas Greiner 2017/08/25 17:11:35 Agreed, I don't think it adds value to add a comme
+ port.on("request.getTypes", (message, sender) =>
+ Array.from(require("requestBlocker").filterTypes));
Thomas Greiner 2017/08/22 11:21:47 Why did you decide to make `filterTypes` a `Set` i
Sebastian Noack 2017/08/22 11:38:28 The way filter types are accumulated in adblockplu
Thomas Greiner 2017/08/25 17:11:35 Ok, not great either way then, I guess. Thanks for
+
// Some modules doesn't exist on Firefox. Moreover,
// require() throws an exception on Firefox in that case.
// However, try/catch causes the whole function to to be
// deoptimized on V8. So we wrap it into another function.
function tryRequire(module)
{
try
{
@@ -425,9 +429,12 @@
subscriptions = [Subscription.fromURL(message.url)];
for (let subscription of subscriptions)
{
if (subscription instanceof DownloadableSubscription)
Synchronizer.execute(subscription, true);
}
});
+
+ port.on("request.getTypes", (message, sender) =>
+ Array.from(require("requestBlocker").filterTypes));
Thomas Greiner 2017/08/22 11:21:47 This is exactly the same code as the one above so
Jon Sonesen 2017/08/24 11:29:06 Acknowledged.
})(this);

Powered by Google App Engine
This is Rietveld