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-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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 } | 75 } |
76 | 76 |
77 function hasRecord(panel, request, filter) | 77 function hasRecord(panel, request, filter) |
78 { | 78 { |
79 return panel.records.some(record => | 79 return panel.records.some(record => |
80 record.request.url == request.url && | 80 record.request.url == request.url && |
81 record.request.docDomain == request.docDomain && | 81 record.request.docDomain == request.docDomain && |
82 | 82 |
83 // Ignore partial (e.g. ELEMHIDE) whitelisting if there is already | 83 // Ignore partial (e.g. ELEMHIDE) whitelisting if there is already |
84 // a DOCUMENT exception which disables all means of blocking. | 84 // a DOCUMENT exception which disables all means of blocking. |
85 (record.request.type == "DOCUMENT" ? | 85 ( |
86 nonRequestTypes.includes(request.type) : | 86 record.request.type == "DOCUMENT" ? |
87 record.request.type == request.type) && | 87 nonRequestTypes.includes(request.type) : |
| 88 record.request.type == request.type |
| 89 ) && |
88 | 90 |
89 // Matched element hiding filters don't relate to a particular request, | 91 // Matched element hiding filters don't relate to a particular request, |
90 // so we have to compare the selector in order to avoid duplicates. | 92 // so we have to compare the selector in order to avoid duplicates. |
91 (record.filter && record.filter.selector) == (filter && filter.selector) | 93 (record.filter && record.filter.selector) == (filter && filter.selector) |
92 ); | 94 ); |
93 } | 95 } |
94 | 96 |
95 function addRecord(panel, request, filter) | 97 function addRecord(panel, request, filter) |
96 { | 98 { |
97 if (!hasRecord(panel, request, filter)) | 99 if (!hasRecord(panel, request, filter)) |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 panels.set(inspectedTabId, {port: newPort, records: []}); | 379 panels.set(inspectedTabId, {port: newPort, records: []}); |
378 }); | 380 }); |
379 | 381 |
380 port.on("devtools.traceElemHide", (message, sender) => | 382 port.on("devtools.traceElemHide", (message, sender) => |
381 { | 383 { |
382 logHiddenElements( | 384 logHiddenElements( |
383 sender.page, message.selectors, message.filters, | 385 sender.page, message.selectors, message.filters, |
384 extractHostFromFrame(sender.frame) | 386 extractHostFromFrame(sender.frame) |
385 ); | 387 ); |
386 }); | 388 }); |
OLD | NEW |