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-2016 Eyeo GmbH | 3 * Copyright (C) 2006-2016 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 if (devtools) | 57 if (devtools) |
58 devtools.logRequest( | 58 devtools.logRequest( |
59 page, url, type, docDomain, | 59 page, url, type, docDomain, |
60 thirdParty, key, specificOnly, | 60 thirdParty, key, specificOnly, |
61 filter | 61 filter |
62 ); | 62 ); |
63 } | 63 } |
64 | 64 |
65 function onBeforeRequest(url, type, page, frame) | 65 function onBeforeRequest(url, type, page, frame) |
66 { | 66 { |
67 if (isFrameWhitelisted(page, frame)) | 67 if (checkWhitelisted(page, frame)) |
68 return true; | 68 return true; |
69 | 69 |
70 var urlString = stringifyURL(url); | 70 var urlString = stringifyURL(url); |
71 var docDomain = extractHostFromFrame(frame); | 71 var docDomain = extractHostFromFrame(frame); |
72 var thirdParty = isThirdParty(url, docDomain); | 72 var thirdParty = isThirdParty(url, docDomain); |
73 var key = getKey(page, frame); | 73 var key = getKey(page, frame); |
74 | 74 |
75 var specificOnly = isFrameWhitelisted( | 75 var specificOnly = !!checkWhitelisted( |
76 page, frame, RegExpFilter.typeMap.GENERICBLOCK | 76 page, frame, RegExpFilter.typeMap.GENERICBLOCK |
77 ); | 77 ); |
78 | 78 |
79 var filter = defaultMatcher.matchesAny( | 79 var filter = defaultMatcher.matchesAny( |
80 urlString, RegExpFilter.typeMap[type], | 80 urlString, RegExpFilter.typeMap[type], |
81 docDomain, thirdParty, key, specificOnly | 81 docDomain, thirdParty, key, specificOnly |
82 ); | 82 ); |
83 | 83 |
84 setTimeout(onBeforeRequestAsync, 0, page, urlString, | 84 setTimeout(onBeforeRequestAsync, 0, page, urlString, |
85 type, docDomain, | 85 type, docDomain, |
(...skipping 25 matching lines...) Expand all Loading... |
111 | 111 |
112 chrome.webRequest.onHeadersReceived.addListener( | 112 chrome.webRequest.onHeadersReceived.addListener( |
113 onHeadersReceived, | 113 onHeadersReceived, |
114 { | 114 { |
115 urls: ["http://*/*", "https://*/*"], | 115 urls: ["http://*/*", "https://*/*"], |
116 types: ["main_frame", "sub_frame"] | 116 types: ["main_frame", "sub_frame"] |
117 }, | 117 }, |
118 ["responseHeaders"] | 118 ["responseHeaders"] |
119 ); | 119 ); |
120 } | 120 } |
LEFT | RIGHT |