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-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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
62 devtools.logRequest( | 62 devtools.logRequest( |
63 page, url, type, docDomain, | 63 page, url, type, docDomain, |
64 thirdParty, sitekey, | 64 thirdParty, sitekey, |
65 specificOnly, filter | 65 specificOnly, filter |
66 ); | 66 ); |
67 } | 67 } |
68 } | 68 } |
69 | 69 |
70 ext.webRequest.onBeforeRequest.addListener((url, type, page, frame) => | 70 ext.webRequest.onBeforeRequest.addListener((url, type, page, frame) => |
71 { | 71 { |
72 if (checkWhitelisted(page, frame)) | 72 let docDomain = null; |
73 return true; | 73 let sitekey = null; |
74 let specificOnly = false; | |
75 let thirdParty = false; | |
76 let urlString = stringifyURL(url); | |
74 | 77 |
75 let urlString = stringifyURL(url); | 78 if (frame && page) |
Sebastian Noack
2017/06/01 17:32:21
Nit: As mentioned before, I'd add a blank line abo
Jon Sonesen
2017/06/02 05:02:58
Acknowledged.
| |
76 let docDomain = extractHostFromFrame(frame); | 79 { |
77 let thirdParty = isThirdParty(url, docDomain); | 80 if (checkWhitelisted(page, frame)) |
78 let sitekey = getKey(page, frame); | 81 return true; |
79 | 82 |
80 let specificOnly = !!checkWhitelisted( | 83 docDomain = extractHostFromFrame(frame); |
81 page, frame, RegExpFilter.typeMap.GENERICBLOCK | 84 sitekey = getKey(page, frame); |
82 ); | 85 thirdParty = isThirdParty(url, docDomain); |
86 specificOnly = !!checkWhitelisted(page, frame, | |
87 RegExpFilter.typeMap.GENERICBLOCK); | |
88 } | |
89 | |
Sebastian Noack
2017/06/01 17:32:21
Nit: One blank line is sufficient here.
Jon Sonesen
2017/06/02 05:02:58
Acknowledged.
| |
90 | |
83 | 91 |
84 let mappedType = resourceTypes.get(type) || "OTHER"; | 92 let mappedType = resourceTypes.get(type) || "OTHER"; |
85 | 93 |
86 let filter = defaultMatcher.matchesAny( | 94 let filter = defaultMatcher.matchesAny( |
87 urlString, RegExpFilter.typeMap[mappedType], | 95 urlString, RegExpFilter.typeMap[mappedType], |
88 docDomain, thirdParty, sitekey, specificOnly | 96 docDomain, thirdParty, sitekey, specificOnly |
89 ); | 97 ); |
90 | 98 |
91 setTimeout(onBeforeRequestAsync, 0, page, urlString, | 99 setTimeout(onBeforeRequestAsync, 0, page, urlString, |
92 mappedType, docDomain, | 100 mappedType, docDomain, |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
182 if (msg.requestType.toUpperCase() in chrome.webRequest.ResourceType) | 190 if (msg.requestType.toUpperCase() in chrome.webRequest.ResourceType) |
183 return false; | 191 return false; |
184 | 192 |
185 return ext.webRequest.onBeforeRequest._dispatch( | 193 return ext.webRequest.onBeforeRequest._dispatch( |
186 new URL(msg.url), | 194 new URL(msg.url), |
187 msg.requestType, | 195 msg.requestType, |
188 sender.page, | 196 sender.page, |
189 sender.frame | 197 sender.frame |
190 ).includes(false); | 198 ).includes(false); |
191 }); | 199 }); |
OLD | NEW |