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-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 } | 47 } |
48 }); | 48 }); |
49 | 49 |
50 function onBeforeRequest(url, type, page, frame) | 50 function onBeforeRequest(url, type, page, frame) |
51 { | 51 { |
52 if (isFrameWhitelisted(page, frame)) | 52 if (isFrameWhitelisted(page, frame)) |
53 return true; | 53 return true; |
54 | 54 |
55 var docDomain = extractHostFromFrame(frame); | 55 var docDomain = extractHostFromFrame(frame); |
56 var key = getKey(page, frame); | 56 var key = getKey(page, frame); |
| 57 var specificOnly = isFrameWhitelisted(page, frame, "GENERICBLOCK"); |
57 var filter = defaultMatcher.matchesAny( | 58 var filter = defaultMatcher.matchesAny( |
58 stringifyURL(url), | 59 stringifyURL(url), |
59 type == "sub_frame" ? "SUBDOCUMENT" : type.toUpperCase(), | 60 type == "sub_frame" ? "SUBDOCUMENT" : type.toUpperCase(), |
60 docDomain, | 61 docDomain, |
61 isThirdParty(url, docDomain), | 62 isThirdParty(url, docDomain), |
62 key | 63 key, |
| 64 specificOnly |
63 ); | 65 ); |
64 | 66 |
65 // We can't listen to onHeadersReceived in Safari so we need to | 67 // We can't listen to onHeadersReceived in Safari so we need to |
66 // check for notifications here | 68 // check for notifications here |
67 if (platform != "chromium" && type == "sub_frame") | 69 if (platform != "chromium" && type == "sub_frame") |
68 { | 70 { |
69 var notificationToShow = NotificationStorage.getNextToShow(stringifyURL(url)
); | 71 var notificationToShow = NotificationStorage.getNextToShow(stringifyURL(url)
); |
70 if (notificationToShow) | 72 if (notificationToShow) |
71 showNotification(notificationToShow); | 73 showNotification(notificationToShow); |
72 } | 74 } |
(...skipping 27 matching lines...) Expand all Loading... |
100 processKey(header.value, page, frame); | 102 processKey(header.value, page, frame); |
101 } | 103 } |
102 | 104 |
103 var notificationToShow = NotificationStorage.getNextToShow(stringifyURL(new
URL(details.url))); | 105 var notificationToShow = NotificationStorage.getNextToShow(stringifyURL(new
URL(details.url))); |
104 if (notificationToShow) | 106 if (notificationToShow) |
105 showNotification(notificationToShow); | 107 showNotification(notificationToShow); |
106 } | 108 } |
107 | 109 |
108 chrome.webRequest.onHeadersReceived.addListener(onHeadersReceived, {urls: ["ht
tp://*/*", "https://*/*"]}, ["responseHeaders"]); | 110 chrome.webRequest.onHeadersReceived.addListener(onHeadersReceived, {urls: ["ht
tp://*/*", "https://*/*"]}, ["responseHeaders"]); |
109 } | 111 } |
OLD | NEW |