LEFT | RIGHT |
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-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 |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
(...skipping 15 matching lines...) Expand all Loading... |
29 const {FilterStorage} = require("filterStorage"); | 29 const {FilterStorage} = require("filterStorage"); |
30 const {FilterNotifier} = require("filterNotifier"); | 30 const {FilterNotifier} = require("filterNotifier"); |
31 const {defaultMatcher} = require("matcher"); | 31 const {defaultMatcher} = require("matcher"); |
32 const {ElemHideEmulation} = require("elemHideEmulation"); | 32 const {ElemHideEmulation} = require("elemHideEmulation"); |
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 { |
40 DownloadableSubscription, | 40 Subscription, |
41 SpecialSubscription} = require("subscriptionClasses"); | 41 DownloadableSubscription, |
| 42 SpecialSubscription |
| 43 } = require("subscriptionClasses"); |
42 | 44 |
43 // Some modules doesn't exist on Firefox. Moreover, | 45 // Some modules doesn't exist on Firefox. Moreover, |
44 // require() throws an exception on Firefox in that case. | 46 // require() throws an exception on Firefox in that case. |
45 // However, try/catch causes the whole function to to be | 47 // However, try/catch causes the whole function to to be |
46 // deoptimized on V8. So we wrap it into another function. | 48 // deoptimized on V8. So we wrap it into another function. |
47 function tryRequire(module) | 49 function tryRequire(module) |
48 { | 50 { |
49 try | 51 try |
50 { | 52 { |
51 return require(module); | 53 return require(module); |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 return filter instanceof BlockingFilter; | 231 return filter instanceof BlockingFilter; |
230 }); | 232 }); |
231 | 233 |
232 port.on("filters.get", (message, sender) => | 234 port.on("filters.get", (message, sender) => |
233 { | 235 { |
234 if (message.what == "elemhideemulation") | 236 if (message.what == "elemhideemulation") |
235 { | 237 { |
236 let filters = []; | 238 let filters = []; |
237 const {checkWhitelisted} = require("whitelisting"); | 239 const {checkWhitelisted} = require("whitelisting"); |
238 | 240 |
239 if (Prefs.enabled && !checkWhitelisted(sender.page, sender.frame, | 241 let isWhitelisted = checkWhitelisted(sender.page, sender.frame, |
240 RegExpFilter.typeMap.DOCUMENT | | 242 RegExpFilter.typeMap.DOCUMENT | RegExpFilter.typeMap.ELEMHIDE); |
241 RegExpFilter.typeMap.ELEMHIDE)) | 243 if (Prefs.enabled && !isWhitelisted) |
242 { | 244 { |
243 let {hostname} = sender.frame.url; | 245 let {hostname} = sender.frame.url; |
244 filters = ElemHideEmulation.getRulesForDomain(hostname); | 246 filters = ElemHideEmulation.getRulesForDomain(hostname); |
245 filters = filters.map((filter) => | 247 filters = filters.map((filter) => |
246 { | 248 { |
247 return { | 249 return { |
248 selector: filter.selector, | 250 selector: filter.selector, |
249 text: filter.text | 251 text: filter.text |
250 }; | 252 }; |
251 }); | 253 }); |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 if (message.url) | 434 if (message.url) |
433 subscriptions = [Subscription.fromURL(message.url)]; | 435 subscriptions = [Subscription.fromURL(message.url)]; |
434 | 436 |
435 for (let subscription of subscriptions) | 437 for (let subscription of subscriptions) |
436 { | 438 { |
437 if (subscription instanceof DownloadableSubscription) | 439 if (subscription instanceof DownloadableSubscription) |
438 Synchronizer.execute(subscription, true); | 440 Synchronizer.execute(subscription, true); |
439 } | 441 } |
440 }); | 442 }); |
441 })(this); | 443 })(this); |
LEFT | RIGHT |