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