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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 return panel.records.some(record => | 76 return panel.records.some(record => |
77 record.request.url == request.url && | 77 record.request.url == request.url && |
78 record.request.docDomain == request.docDomain && | 78 record.request.docDomain == request.docDomain && |
79 | 79 |
80 // Ignore partial (e.g. ELEMHIDE) whitelisting if there is already | 80 // Ignore partial (e.g. ELEMHIDE) whitelisting if there is already |
81 // a DOCUMENT exception which disables all means of blocking. | 81 // a DOCUMENT exception which disables all means of blocking. |
82 (record.request.type == "DOCUMENT" ? | 82 (record.request.type == "DOCUMENT" ? |
83 nonRequestTypes.includes(request.type) : | 83 nonRequestTypes.includes(request.type) : |
84 record.request.type == request.type) && | 84 record.request.type == request.type) && |
85 | 85 |
86 // Matched element hiding filters don't relate to a particular request, | 86 // Matched element hiding and CSP filters don't relate to a particular |
87 // so we have to compare the selector in order to avoid duplicates. | 87 // request, so we have to compare the selector or the CSP value in order to |
88 (record.filter && record.filter.selector) == (filter && filter.selector) | 88 // avoid duplicates. |
| 89 (record.filter && record.filter.selector) == (filter && filter.selector) && |
| 90 (record.filter && record.filter.csp) == (filter && filter.csp) |
89 ); | 91 ); |
90 } | 92 } |
91 | 93 |
92 function addRecord(panel, request, filter) | 94 function addRecord(panel, request, filter) |
93 { | 95 { |
94 if (!hasRecord(panel, request, filter)) | 96 if (!hasRecord(panel, request, filter)) |
95 { | 97 { |
96 panel.port.postMessage({ | 98 panel.port.postMessage({ |
97 type: "add-record", | 99 type: "add-record", |
98 request, | 100 request, |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 ext.pages.onLoading.removeListener(onLoading); | 277 ext.pages.onLoading.removeListener(onLoading); |
276 filterNotifier.off("filter.added", onFilterAdded); | 278 filterNotifier.off("filter.added", onFilterAdded); |
277 filterNotifier.off("filter.removed", onFilterRemoved); | 279 filterNotifier.off("filter.removed", onFilterRemoved); |
278 filterNotifier.off("subscription.added", onSubscriptionAdded); | 280 filterNotifier.off("subscription.added", onSubscriptionAdded); |
279 } | 281 } |
280 }); | 282 }); |
281 | 283 |
282 HitLogger.addListener(inspectedTabId, hitListener); | 284 HitLogger.addListener(inspectedTabId, hitListener); |
283 panels.set(inspectedTabId, panel); | 285 panels.set(inspectedTabId, panel); |
284 }); | 286 }); |
OLD | NEW |