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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 { | 61 { |
62 logRequest( | 62 logRequest( |
63 [details.tabId], | 63 [details.tabId], |
64 {url: details.url, type: "CSP", docDomain: hostname, specificOnly}, | 64 {url: details.url, type: "CSP", docDomain: hostname, specificOnly}, |
65 cspMatch | 65 cspMatch |
66 ); | 66 ); |
67 filterNotifier.emit("filter.hitCount", cspMatch, 0, 0, [details.tabId]); | 67 filterNotifier.emit("filter.hitCount", cspMatch, 0, 0, [details.tabId]); |
68 return; | 68 return; |
69 } | 69 } |
70 | 70 |
71 let {blocking} = defaultMatcher.search(url, typeMap.CSP, hostname, | 71 let {blocking} = defaultMatcher.search(url, typeMap.CSP, hostname, null, |
72 null, specificOnly, | 72 specificOnly, "blocking"); |
73 "blocking"); | |
74 for (cspMatch of blocking) | 73 for (cspMatch of blocking) |
75 { | 74 { |
76 logRequest( | 75 logRequest( |
77 [details.tabId], | 76 [details.tabId], |
78 {url: details.url, type: "CSP", docDomain: hostname, specificOnly}, | 77 {url: details.url, type: "CSP", docDomain: hostname, specificOnly}, |
79 cspMatch | 78 cspMatch |
80 ); | 79 ); |
81 filterNotifier.emit("filter.hitCount", cspMatch, 0, 0, [details.tabId]); | 80 filterNotifier.emit("filter.hitCount", cspMatch, 0, 0, [details.tabId]); |
82 | 81 |
83 details.responseHeaders.push({ | 82 details.responseHeaders.push({ |
84 name: "Content-Security-Policy", | 83 name: "Content-Security-Policy", |
85 value: cspMatch.csp | 84 value: cspMatch.csp |
86 }); | 85 }); |
87 } | 86 } |
88 | 87 |
89 return {responseHeaders: details.responseHeaders}; | 88 return {responseHeaders: details.responseHeaders}; |
90 } | 89 } |
91 }, { | 90 }, { |
92 urls: ["http://*/*", "https://*/*"], | 91 urls: ["http://*/*", "https://*/*"], |
93 types: ["main_frame", "sub_frame"] | 92 types: ["main_frame", "sub_frame"] |
94 }, ["blocking", "responseHeaders"]); | 93 }, ["blocking", "responseHeaders"]); |
LEFT | RIGHT |