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-2016 Eyeo GmbH | 3 * Copyright (C) 2006-2016 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 12 matching lines...) Expand all Loading... |
23 var devtools = require("devtools"); | 23 var devtools = require("devtools"); |
24 | 24 |
25 port.on("get-selectors", function(msg, sender) | 25 port.on("get-selectors", function(msg, sender) |
26 { | 26 { |
27 var selectors; | 27 var selectors; |
28 var trace = devtools && devtools.hasPanel(sender.page); | 28 var trace = devtools && devtools.hasPanel(sender.page); |
29 | 29 |
30 if (!checkWhitelisted(sender.page, sender.frame, | 30 if (!checkWhitelisted(sender.page, sender.frame, |
31 RegExpFilter.typeMap.DOCUMENT | | 31 RegExpFilter.typeMap.DOCUMENT | |
32 RegExpFilter.typeMap.ELEMHIDE)) | 32 RegExpFilter.typeMap.ELEMHIDE)) |
| 33 { |
| 34 var specificOnly = checkWhitelisted(sender.page, sender.frame, |
| 35 RegExpFilter.typeMap.GENERICHIDE); |
33 selectors = ElemHide.getSelectorsForDomain( | 36 selectors = ElemHide.getSelectorsForDomain( |
34 extractHostFromFrame(sender.frame), | 37 extractHostFromFrame(sender.frame), |
35 checkWhitelisted(sender.page, sender.frame, | 38 specificOnly ? ElemHide.SPECIFIC_ONLY : ElemHide.ALL_MATCHING |
36 RegExpFilter.typeMap.GENERICHIDE) | |
37 ); | 39 ); |
| 40 } |
38 else | 41 else |
| 42 { |
39 selectors = []; | 43 selectors = []; |
| 44 } |
40 | 45 |
41 return {selectors: selectors, trace: trace}; | 46 return {selectors: selectors, trace: trace}; |
42 }); | 47 }); |
43 | 48 |
44 port.on("forward", function(msg, sender) | 49 port.on("forward", function(msg, sender) |
45 { | 50 { |
46 var targetPage; | 51 var targetPage; |
47 if (msg.targetPageId) | 52 if (msg.targetPageId) |
48 targetPage = ext.getPage(msg.targetPageId); | 53 targetPage = ext.getPage(msg.targetPageId); |
49 else | 54 else |
50 targetPage = sender.page; | 55 targetPage = sender.page; |
51 | 56 |
52 if (targetPage) | 57 if (targetPage) |
53 { | 58 { |
54 msg.payload.sender = sender.page.id; | 59 msg.payload.sender = sender.page.id; |
55 if (msg.expectsResponse) | 60 if (msg.expectsResponse) |
56 return new Promise(targetPage.sendMessage.bind(targetPage, msg.payload)); | 61 return new Promise(targetPage.sendMessage.bind(targetPage, msg.payload)); |
57 targetPage.sendMessage(msg.payload); | 62 targetPage.sendMessage(msg.payload); |
58 } | 63 } |
59 }); | 64 }); |
OLD | NEW |