Left: | ||
Right: |
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-2017 eyeo GmbH | 3 * Copyright (C) 2006-2017 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 19 matching lines...) Expand all Loading... | |
30 const devtools = require("devtools"); | 30 const devtools = require("devtools"); |
31 | 31 |
32 // Chrome and Firefox (WebExtensions) can't distinguish between | 32 // Chrome and Firefox (WebExtensions) can't distinguish between |
33 // OBJECT_SUBREQUEST and OBJECT requests. | 33 // OBJECT_SUBREQUEST and OBJECT requests. |
34 RegExpFilter.typeMap.OBJECT_SUBREQUEST = RegExpFilter.typeMap.OBJECT; | 34 RegExpFilter.typeMap.OBJECT_SUBREQUEST = RegExpFilter.typeMap.OBJECT; |
35 | 35 |
36 // Map of content types reported by the browser to the respecitve content types | 36 // Map of content types reported by the browser to the respecitve content types |
37 // used by Adblock Plus. Other content types are simply mapped to OTHER. | 37 // used by Adblock Plus. Other content types are simply mapped to OTHER. |
38 let resourceTypes = new Map(function*() | 38 let resourceTypes = new Map(function*() |
39 { | 39 { |
40 for (let type of Object.keys(RegExpFilter.typeMap)) | 40 for (let type in RegExpFilter.typeMap) |
Manish Jethani
2017/05/19 23:44:15
This by the way could just be:
yield* Object.ke
Sebastian Noack
2017/05/20 06:42:37
It seems all versions of Chrome that support gener
Manish Jethani
2017/05/20 18:50:47
Done.
| |
41 yield [type.toLowerCase(), type]; | 41 yield [type.toLowerCase(), type]; |
42 | 42 |
43 yield ["sub_frame", "SUBDOCUMENT"]; | 43 yield ["sub_frame", "SUBDOCUMENT"]; |
44 | 44 |
45 // Treat navigator.sendBeacon() the same as <a ping>, it's essentially the | 45 // Treat navigator.sendBeacon() the same as <a ping>, it's essentially the |
46 // same concept - merely generalized. | 46 // same concept - merely generalized. |
47 yield ["beacon", "PING"]; | 47 yield ["beacon", "PING"]; |
48 | 48 |
49 // Treat <img srcset> and <picture> the same as other images. | 49 // Treat <img srcset> and <picture> the same as other images. |
50 yield ["imageset", "IMAGE"]; | 50 yield ["imageset", "IMAGE"]; |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
182 if (msg.requestType in chrome.webRequest.ResourceType) | 182 if (msg.requestType in chrome.webRequest.ResourceType) |
183 return false; | 183 return false; |
184 | 184 |
185 return ext.webRequest.onBeforeRequest._dispatch( | 185 return ext.webRequest.onBeforeRequest._dispatch( |
186 new URL(msg.url), | 186 new URL(msg.url), |
187 msg.requestType, | 187 msg.requestType, |
188 sender.page, | 188 sender.page, |
189 sender.frame | 189 sender.frame |
190 ).includes(false); | 190 ).includes(false); |
191 }); | 191 }); |
LEFT | RIGHT |