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-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 |
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 * |
14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
16 */ | 16 */ |
17 | 17 |
18 "use strict"; | 18 "use strict"; |
19 | 19 |
20 let {RegExpFilter, WhitelistFilter, | 20 const {RegExpFilter, |
21 ElemHideFilter, ElemHideEmulationFilter} = require("filterClasses"); | 21 WhitelistFilter, |
22 let {SpecialSubscription} = require("subscriptionClasses"); | 22 ElemHideFilter, |
23 let {FilterStorage} = require("filterStorage"); | 23 ElemHideEmulationFilter} = require("filterClasses"); |
24 let {defaultMatcher} = require("matcher"); | 24 |
25 let {FilterNotifier} = require("filterNotifier"); | 25 const {SpecialSubscription} = require("subscriptionClasses"); |
26 let {extractHostFromFrame} = require("url"); | 26 const {FilterStorage} = require("filterStorage"); |
27 let {port} = require("messaging"); | 27 const {defaultMatcher} = require("matcher"); |
| 28 const {FilterNotifier} = require("filterNotifier"); |
| 29 const {extractHostFromFrame} = require("url"); |
| 30 const {port} = require("messaging"); |
28 | 31 |
29 const nonRequestTypes = ["DOCUMENT", "ELEMHIDE", "GENERICBLOCK", "GENERICHIDE"]; | 32 const nonRequestTypes = ["DOCUMENT", "ELEMHIDE", "GENERICBLOCK", "GENERICHIDE"]; |
30 | 33 |
31 // Mapping of inspected tabs to their devpanel page | 34 // Mapping of inspected tabs to their devpanel page |
32 // and recorded items. We can't use a PageMap here, | 35 // and recorded items. We can't use a PageMap here, |
33 // because data must persist after navigation/reload. | 36 // because data must persist after navigation/reload. |
34 let panels = Object.create(null); | 37 let panels = Object.create(null); |
35 | 38 |
36 function hasPanels() | 39 function hasPanels() |
37 { | 40 { |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 let panel = getActivePanel(page); | 166 let panel = getActivePanel(page); |
164 if (panel) | 167 if (panel) |
165 { | 168 { |
166 for (let subscription of FilterStorage.subscriptions) | 169 for (let subscription of FilterStorage.subscriptions) |
167 { | 170 { |
168 if (subscription.disabled) | 171 if (subscription.disabled) |
169 continue; | 172 continue; |
170 | 173 |
171 for (let filter of subscription.filters) | 174 for (let filter of subscription.filters) |
172 { | 175 { |
173 if (!(filter instanceof ElemHideFilter || | 176 if (!(filter instanceof ElemHideFilter) && |
174 filter instanceof ElemHideEmulationFilter)) | 177 !(filter instanceof ElemHideEmulationFilter)) |
175 continue; | 178 continue; |
176 if (selectors.indexOf(filter.selector) == -1) | 179 if (selectors.indexOf(filter.selector) == -1) |
177 continue; | 180 continue; |
178 if (!filter.isActiveOnDomain(docDomain)) | 181 if (!filter.isActiveOnDomain(docDomain)) |
179 continue; | 182 continue; |
180 | 183 |
181 addRecord(panel, {type: "ELEMHIDE", docDomain: docDomain}, filter); | 184 addRecord(panel, {type: "ELEMHIDE", docDomain: docDomain}, filter); |
182 } | 185 } |
183 } | 186 } |
184 } | 187 } |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 panels[inspectedTabId] = {port: port, records: []}; | 382 panels[inspectedTabId] = {port: port, records: []}; |
380 }); | 383 }); |
381 | 384 |
382 port.on("devtools.traceElemHide", (message, sender) => | 385 port.on("devtools.traceElemHide", (message, sender) => |
383 { | 386 { |
384 logHiddenElements( | 387 logHiddenElements( |
385 sender.page, message.selectors, | 388 sender.page, message.selectors, |
386 extractHostFromFrame(sender.frame) | 389 extractHostFromFrame(sender.frame) |
387 ); | 390 ); |
388 }); | 391 }); |
LEFT | RIGHT |