 Issue 29522650:
  Issue 5316 - Adds dynamic filter types to devtools panel  (Closed)
    
  
    Issue 29522650:
  Issue 5316 - Adds dynamic filter types to devtools panel  (Closed) 
  | Left: | ||
| Right: | 
| OLD | NEW | 
|---|---|
| 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-present eyeo GmbH | 3 * Copyright (C) 2006-present 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 24 matching lines...) Expand all Loading... | |
| 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 { | 39 const { | 
| 40 Subscription, | 40 Subscription, | 
| 41 DownloadableSubscription, | 41 DownloadableSubscription, | 
| 42 SpecialSubscription | 42 SpecialSubscription | 
| 43 } = require("subscriptionClasses"); | 43 } = require("subscriptionClasses"); | 
| 44 | 44 | 
| 45 port.on("types.get", (message, sender) => | |
| 46 { | |
| 47 let filterTypes = Array.from(require("requestBlocker").filterTypes); | |
| 48 filterTypes.push(filterTypes.splice(filterTypes.indexOf("OTHER"), 1)[0]); | |
| 
Sebastian Noack
2017/09/11 16:44:14
I would rather use the rest operator here. That wa
 
Jon Sonesen
2017/09/12 11:42:41
Oh, nifty. Thanks for pointing that out
 | |
| 49 return filterTypes; | |
| 50 }); | |
| 51 | |
| 45 // Some modules doesn't exist on Firefox. Moreover, | 52 // Some modules doesn't exist on Firefox. Moreover, | 
| 46 // require() throws an exception on Firefox in that case. | 53 // require() throws an exception on Firefox in that case. | 
| 47 // However, try/catch causes the whole function to to be | 54 // However, try/catch causes the whole function to to be | 
| 48 // deoptimized on V8. So we wrap it into another function. | 55 // deoptimized on V8. So we wrap it into another function. | 
| 49 function tryRequire(module) | 56 function tryRequire(module) | 
| 50 { | 57 { | 
| 51 try | 58 try | 
| 52 { | 59 { | 
| 53 return require(module); | 60 return require(module); | 
| 54 } | 61 } | 
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 434 if (message.url) | 441 if (message.url) | 
| 435 subscriptions = [Subscription.fromURL(message.url)]; | 442 subscriptions = [Subscription.fromURL(message.url)]; | 
| 436 | 443 | 
| 437 for (let subscription of subscriptions) | 444 for (let subscription of subscriptions) | 
| 438 { | 445 { | 
| 439 if (subscription instanceof DownloadableSubscription) | 446 if (subscription instanceof DownloadableSubscription) | 
| 440 Synchronizer.execute(subscription, true); | 447 Synchronizer.execute(subscription, true); | 
| 441 } | 448 } | 
| 442 }); | 449 }); | 
| 443 })(this); | 450 })(this); | 
| OLD | NEW |