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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 return; | 61 return; |
62 | 62 |
63 for (let type in browser.webRequest.ResourceType) | 63 for (let type in browser.webRequest.ResourceType) |
64 yield resourceTypes.get(browser.webRequest.ResourceType[type]) || "OTHER"; | 64 yield resourceTypes.get(browser.webRequest.ResourceType[type]) || "OTHER"; |
65 | 65 |
66 // WEBSOCKET and WEBRTC get addressed through workarounds, even if the | 66 // WEBSOCKET and WEBRTC get addressed through workarounds, even if the |
67 // webRequest API is lacking support to block these kind of requests. | 67 // webRequest API is lacking support to block these kind of requests. |
68 yield "WEBSOCKET"; | 68 yield "WEBSOCKET"; |
69 yield "WEBRTC"; | 69 yield "WEBRTC"; |
70 | 70 |
71 // POPUP and ELEMHIDE filters aren't blocked on the request level but by other | 71 // POPUP, CSP and ELEMHIDE filters aren't blocked on the request level but by |
72 // means. They don't have a corresponding value in webRequest.ResourceType. | 72 // other means. They don't have a corresponding value in |
| 73 // webRequest.ResourceType. |
73 yield "POPUP"; | 74 yield "POPUP"; |
74 yield "ELEMHIDE"; | 75 yield "ELEMHIDE"; |
| 76 yield "CSP"; |
75 }()); | 77 }()); |
76 | 78 |
77 function onBeforeRequestAsync(page, url, type, docDomain, | 79 function onBeforeRequestAsync(page, url, type, docDomain, |
78 thirdParty, sitekey, | 80 thirdParty, sitekey, |
79 specificOnly, filter) | 81 specificOnly, filter) |
80 { | 82 { |
81 if (filter) | 83 if (filter) |
82 FilterNotifier.emit("filter.hitCount", filter, 0, 0, page); | 84 FilterNotifier.emit("filter.hitCount", filter, 0, 0, page); |
83 | 85 |
84 if (devtools) | 86 if (devtools) |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 return false; | 220 return false; |
219 } | 221 } |
220 | 222 |
221 return ext.webRequest.onBeforeRequest._dispatch( | 223 return ext.webRequest.onBeforeRequest._dispatch( |
222 new URL(msg.url), | 224 new URL(msg.url), |
223 msg.requestType, | 225 msg.requestType, |
224 sender.page, | 226 sender.page, |
225 sender.frame | 227 sender.frame |
226 ).includes(false); | 228 ).includes(false); |
227 }); | 229 }); |
OLD | NEW |