| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 devtools.logRequest( | 44 devtools.logRequest( |
| 45 page, url, type, docDomain, | 45 page, url, type, docDomain, |
| 46 thirdParty, sitekey, | 46 thirdParty, sitekey, |
| 47 specificOnly, filter | 47 specificOnly, filter |
| 48 ); | 48 ); |
| 49 } | 49 } |
| 50 } | 50 } |
| 51 | 51 |
| 52 ext.webRequest.onBeforeRequest.addListener((url, type, page, frame) => | 52 ext.webRequest.onBeforeRequest.addListener((url, type, page, frame) => |
| 53 { | 53 { |
| 54 if (checkWhitelisted(page, frame)) | 54 let docDomain = null; |
| 55 return true; | 55 let sitekey = null; |
| 56 | 56 |
| 57 let specificOnly = false; |
| 58 let thirdParty = false; |
| 57 let urlString = stringifyURL(url); | 59 let urlString = stringifyURL(url); |
| 58 let docDomain = extractHostFromFrame(frame); | |
| 59 let thirdParty = isThirdParty(url, docDomain); | |
| 60 let sitekey = getKey(page, frame); | |
| 61 | 60 |
| 62 let specificOnly = !!checkWhitelisted( | 61 if (frame && page) |
| 63 page, frame, RegExpFilter.typeMap.GENERICBLOCK | 62 { |
| 63 if (checkWhitelisted(page, frame)) |
| 64 return true; |
| 65 |
| 66 docDomain = extractHostFromFrame(frame); |
| 67 sitekey = getKey(page, frame); |
| 68 thirdParty = isThirdParty(url, docDomain); |
| 69 specificOnly = !!checkWhitelisted( |
| 70 page, frame, RegExpFilter.typeMap.GENERICBLOCK |
| 64 ); | 71 ); |
| 72 } |
| 73 |
| 74 |
| 65 | 75 |
| 66 let filter = defaultMatcher.matchesAny( | 76 let filter = defaultMatcher.matchesAny( |
| 67 urlString, RegExpFilter.typeMap[type], | 77 urlString, RegExpFilter.typeMap[type], |
| 68 docDomain, thirdParty, sitekey, specificOnly | 78 docDomain, thirdParty, sitekey, specificOnly |
| 69 ); | 79 ); |
| 70 | 80 |
| 71 setTimeout(onBeforeRequestAsync, 0, page, urlString, | 81 setTimeout(onBeforeRequestAsync, 0, page, urlString, |
| 72 type, docDomain, | 82 type, docDomain, |
| 73 thirdParty, sitekey, | 83 thirdParty, sitekey, |
| 74 specificOnly, filter); | 84 specificOnly, filter); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 if (msg.requestType in chrome.webRequest.ResourceType) | 172 if (msg.requestType in chrome.webRequest.ResourceType) |
| 163 return false; | 173 return false; |
| 164 | 174 |
| 165 return ext.webRequest.onBeforeRequest._dispatch( | 175 return ext.webRequest.onBeforeRequest._dispatch( |
| 166 new URL(msg.url), | 176 new URL(msg.url), |
| 167 msg.requestType, | 177 msg.requestType, |
| 168 sender.page, | 178 sender.page, |
| 169 sender.frame | 179 sender.frame |
| 170 ).includes(false); | 180 ).includes(false); |
| 171 }); | 181 }); |
| OLD | NEW |