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 | 74 |
75 let specificOnly = false; | |
Sebastian Noack
2017/05/30 11:10:49
Nit: The blank line above looks redundant, but ins
Jon Sonesen
2017/05/31 08:28:18
Acknowledged.
| |
76 let thirdParty = false; | |
75 let urlString = stringifyURL(url); | 77 let urlString = stringifyURL(url); |
76 let docDomain = extractHostFromFrame(frame); | |
77 let thirdParty = isThirdParty(url, docDomain); | |
78 let sitekey = getKey(page, frame); | |
79 | 78 |
80 let specificOnly = !!checkWhitelisted( | 79 if (frame && page) |
81 page, frame, RegExpFilter.typeMap.GENERICBLOCK | 80 { |
81 if (checkWhitelisted(page, frame)) | |
82 return true; | |
83 | |
84 docDomain = extractHostFromFrame(frame); | |
85 sitekey = getKey(page, frame); | |
86 thirdParty = isThirdParty(url, docDomain); | |
87 specificOnly = !!checkWhitelisted( | |
88 page, frame, RegExpFilter.typeMap.GENERICBLOCK | |
82 ); | 89 ); |
Sebastian Noack
2017/05/30 11:10:49
Nit: You added one level off indentation to the co
Jon Sonesen
2017/05/31 08:28:18
I will do it as you suggest.
| |
90 } | |
91 | |
92 | |
83 | 93 |
84 let mappedType = resourceTypes.get(type) || "OTHER"; | 94 let mappedType = resourceTypes.get(type) || "OTHER"; |
85 | 95 |
86 let filter = defaultMatcher.matchesAny( | 96 let filter = defaultMatcher.matchesAny( |
87 urlString, RegExpFilter.typeMap[mappedType], | 97 urlString, RegExpFilter.typeMap[mappedType], |
88 docDomain, thirdParty, sitekey, specificOnly | 98 docDomain, thirdParty, sitekey, specificOnly |
89 ); | 99 ); |
90 | 100 |
91 setTimeout(onBeforeRequestAsync, 0, page, urlString, | 101 setTimeout(onBeforeRequestAsync, 0, page, urlString, |
92 mappedType, docDomain, | 102 mappedType, docDomain, |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
182 if (msg.requestType.toUpperCase() in chrome.webRequest.ResourceType) | 192 if (msg.requestType.toUpperCase() in chrome.webRequest.ResourceType) |
183 return false; | 193 return false; |
184 | 194 |
185 return ext.webRequest.onBeforeRequest._dispatch( | 195 return ext.webRequest.onBeforeRequest._dispatch( |
186 new URL(msg.url), | 196 new URL(msg.url), |
187 msg.requestType, | 197 msg.requestType, |
188 sender.page, | 198 sender.page, |
189 sender.frame | 199 sender.frame |
190 ).includes(false); | 200 ).includes(false); |
191 }); | 201 }); |
OLD | NEW |