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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 filters don't relate to a particular request, |
87 // so we have to compare the selector in order to avoid duplicates. | 87 // so we have to compare the selector in order to avoid duplicates. |
88 (record.filter && record.filter.selector) == (filter && filter.selector) | 88 (record.filter && record.filter.selector) == (filter && filter.selector) && |
| 89 |
| 90 // We apply multiple CSP filters to a document, but we must still remove |
| 91 // any duplicates. Two CSP filters are duplicates if both have identical |
| 92 // text. |
| 93 (record.filter && record.filter.csp && record.filter.text) == |
| 94 (filter && filter.csp && filter.text) |
89 ); | 95 ); |
90 } | 96 } |
91 | 97 |
92 function addRecord(panel, request, filter) | 98 function addRecord(panel, request, filter) |
93 { | 99 { |
94 if (!hasRecord(panel, request, filter)) | 100 if (!hasRecord(panel, request, filter)) |
95 { | 101 { |
96 panel.port.postMessage({ | 102 panel.port.postMessage({ |
97 type: "add-record", | 103 type: "add-record", |
98 request, | 104 request, |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 ext.pages.onLoading.removeListener(onLoading); | 281 ext.pages.onLoading.removeListener(onLoading); |
276 filterNotifier.off("filter.added", onFilterAdded); | 282 filterNotifier.off("filter.added", onFilterAdded); |
277 filterNotifier.off("filter.removed", onFilterRemoved); | 283 filterNotifier.off("filter.removed", onFilterRemoved); |
278 filterNotifier.off("subscription.added", onSubscriptionAdded); | 284 filterNotifier.off("subscription.added", onSubscriptionAdded); |
279 } | 285 } |
280 }); | 286 }); |
281 | 287 |
282 HitLogger.addListener(inspectedTabId, hitListener); | 288 HitLogger.addListener(inspectedTabId, hitListener); |
283 panels.set(inspectedTabId, panel); | 289 panels.set(inspectedTabId, panel); |
284 }); | 290 }); |
OLD | NEW |