Left: | ||
Right: |
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
46 yield ["sub_frame", "SUBDOCUMENT"]; | 46 yield ["sub_frame", "SUBDOCUMENT"]; |
47 | 47 |
48 // Treat navigator.sendBeacon() the same as <a ping>, it's essentially the | 48 // Treat navigator.sendBeacon() the same as <a ping>, it's essentially the |
49 // same concept - merely generalized. | 49 // same concept - merely generalized. |
50 yield ["beacon", "PING"]; | 50 yield ["beacon", "PING"]; |
51 | 51 |
52 // Treat <img srcset> and <picture> the same as other images. | 52 // Treat <img srcset> and <picture> the same as other images. |
53 yield ["imageset", "IMAGE"]; | 53 yield ["imageset", "IMAGE"]; |
54 }()); | 54 }()); |
55 | 55 |
56 exports.filterTypes = new Set(function*() | |
57 { | |
58 // Microsoft Edge does not have webRequest.ResourceType or the devtools panel. | |
59 // Since filterTypes is only used by devtools, we can just bail out here. | |
60 if (!(chrome.webRequest.ResourceType)) | |
61 return; | |
62 for (let type in chrome.webRequest.ResourceType) | |
Sebastian Noack
2017/09/06 18:06:48
The code looks a little squashed. Perhaps add a bl
Jon Sonesen
2017/09/07 08:10:04
Done.
| |
63 yield resourceTypes.get(chrome.webRequest.ResourceType[type]) || "OTHER"; | |
64 // WEBSOCKET and WEBRTC get addressed through workarounds, even if webRequest | |
Sebastian Noack
2017/09/06 18:06:48
Perhaps also add a blank line here?
Sebastian Noack
2017/09/06 18:06:48
"webrequest" => "the webRequest API"
Jon Sonesen
2017/09/07 08:10:04
Done.
| |
65 // is lacking support to block these kind of requests. | |
66 yield "WEBSOCKET"; | |
67 yield "WEBRTC"; | |
68 // POPUP and ELEMHIDE filters aren't blocked on the request level but by other | |
Sebastian Noack
2017/09/06 18:06:49
Perhaps also add a blank line here?
Jon Sonesen
2017/09/07 08:10:04
Done.
| |
69 // means. They don't have a corresponding value in webRequest.ResourceType. | |
70 yield "POPUP"; | |
71 yield "ELEMHIDE"; | |
72 }()); | |
73 | |
56 function onBeforeRequestAsync(page, url, type, docDomain, | 74 function onBeforeRequestAsync(page, url, type, docDomain, |
57 thirdParty, sitekey, | 75 thirdParty, sitekey, |
58 specificOnly, filter) | 76 specificOnly, filter) |
59 { | 77 { |
60 if (filter) | 78 if (filter) |
61 FilterNotifier.emit("filter.hitCount", filter, 0, 0, page); | 79 FilterNotifier.emit("filter.hitCount", filter, 0, 0, page); |
62 | 80 |
63 if (devtools) | 81 if (devtools) |
64 { | 82 { |
65 devtools.logRequest( | 83 devtools.logRequest( |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
197 return false; | 215 return false; |
198 } | 216 } |
199 | 217 |
200 return ext.webRequest.onBeforeRequest._dispatch( | 218 return ext.webRequest.onBeforeRequest._dispatch( |
201 new URL(msg.url), | 219 new URL(msg.url), |
202 msg.requestType, | 220 msg.requestType, |
203 sender.page, | 221 sender.page, |
204 sender.frame | 222 sender.frame |
205 ).includes(false); | 223 ).includes(false); |
206 }); | 224 }); |
OLD | NEW |