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

Side by Side 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.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2017 eyeo GmbH 3 * Copyright (C) 2006-2017 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
(...skipping 22 matching lines...) Expand all
33 const {Notification: NotificationStorage} = require("notification"); 33 const {Notification: NotificationStorage} = require("notification");
34 34
35 const {Filter, BlockingFilter, RegExpFilter} = require("filterClasses"); 35 const {Filter, BlockingFilter, RegExpFilter} = require("filterClasses");
36 const {Synchronizer} = require("synchronizer"); 36 const {Synchronizer} = require("synchronizer");
37 37
38 const info = require("info"); 38 const info = require("info");
39 const {Subscription, 39 const {Subscription,
40 DownloadableSubscription, 40 DownloadableSubscription,
41 SpecialSubscription} = require("subscriptionClasses"); 41 SpecialSubscription} = require("subscriptionClasses");
42 42
43 // 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
44 port.on("request.getTypes", (message, sender) =>
45 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
46
43 // Some modules doesn't exist on Firefox. Moreover, 47 // Some modules doesn't exist on Firefox. Moreover,
44 // require() throws an exception on Firefox in that case. 48 // require() throws an exception on Firefox in that case.
45 // However, try/catch causes the whole function to to be 49 // However, try/catch causes the whole function to to be
46 // deoptimized on V8. So we wrap it into another function. 50 // deoptimized on V8. So we wrap it into another function.
47 function tryRequire(module) 51 function tryRequire(module)
48 { 52 {
49 try 53 try
50 { 54 {
51 return require(module); 55 return require(module);
52 } 56 }
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 let {subscriptions} = FilterStorage; 427 let {subscriptions} = FilterStorage;
424 if (message.url) 428 if (message.url)
425 subscriptions = [Subscription.fromURL(message.url)]; 429 subscriptions = [Subscription.fromURL(message.url)];
426 430
427 for (let subscription of subscriptions) 431 for (let subscription of subscriptions)
428 { 432 {
429 if (subscription instanceof DownloadableSubscription) 433 if (subscription instanceof DownloadableSubscription)
430 Synchronizer.execute(subscription, true); 434 Synchronizer.execute(subscription, true);
431 } 435 }
432 }); 436 });
437
438 port.on("request.getTypes", (message, sender) =>
439 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.
433 })(this); 440 })(this);
OLDNEW

Powered by Google App Engine
This is Rietveld