| 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 |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
| 13 * | 13 * |
| 14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
| 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
| 16 */ | 16 */ |
| 17 | 17 |
| 18 var FilterNotifier = require("filterNotifier").FilterNotifier; | 18 var FilterNotifier = require("filterNotifier").FilterNotifier; |
| 19 var RegExpFilter = require("filterClasses").RegExpFilter; | 19 var RegExpFilter = require("filterClasses").RegExpFilter; |
| 20 var platform = require("info").platform; | 20 var platform = require("info").platform; |
| 21 var logRequest = require("devtools").logRequest; |
| 21 | 22 |
| 22 var onFilterChangeTimeout = null; | 23 var onFilterChangeTimeout = null; |
| 23 function onFilterChange() | 24 function onFilterChange() |
| 24 { | 25 { |
| 25 onFilterChangeTimeout = null; | 26 onFilterChangeTimeout = null; |
| 26 ext.webRequest.handlerBehaviorChanged(); | 27 ext.webRequest.handlerBehaviorChanged(); |
| 27 } | 28 } |
| 28 | 29 |
| 29 var importantNotifications = { | 30 var importantNotifications = { |
| 30 'filter.added': true, | 31 'filter.added': true, |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 | 71 |
| 71 // We can't listen to onHeadersReceived in Safari so we need to | 72 // We can't listen to onHeadersReceived in Safari so we need to |
| 72 // check for notifications here | 73 // check for notifications here |
| 73 if (platform != "chromium" && type == "SUBDOCUMENT") | 74 if (platform != "chromium" && type == "SUBDOCUMENT") |
| 74 { | 75 { |
| 75 var notificationToShow = NotificationStorage.getNextToShow(stringifyURL(url)
); | 76 var notificationToShow = NotificationStorage.getNextToShow(stringifyURL(url)
); |
| 76 if (notificationToShow) | 77 if (notificationToShow) |
| 77 showNotification(notificationToShow); | 78 showNotification(notificationToShow); |
| 78 } | 79 } |
| 79 | 80 |
| 81 logRequest(page, url, type, docDomain, key, filter); |
| 80 FilterNotifier.triggerListeners("filter.hitCount", filter, 0, 0, page); | 82 FilterNotifier.triggerListeners("filter.hitCount", filter, 0, 0, page); |
| 83 |
| 81 return !(filter instanceof BlockingFilter); | 84 return !(filter instanceof BlockingFilter); |
| 82 } | 85 } |
| 83 | 86 |
| 84 ext.webRequest.onBeforeRequest.addListener(onBeforeRequest); | 87 ext.webRequest.onBeforeRequest.addListener(onBeforeRequest); |
| 85 | 88 |
| 86 if (platform == "chromium") | 89 if (platform == "chromium") |
| 87 { | 90 { |
| 88 function onHeadersReceived(details) | 91 function onHeadersReceived(details) |
| 89 { | 92 { |
| 90 if (details.tabId == -1) | 93 if (details.tabId == -1) |
| (...skipping 15 matching lines...) Expand all Loading... |
| 106 processKey(header.value, page, frame); | 109 processKey(header.value, page, frame); |
| 107 } | 110 } |
| 108 | 111 |
| 109 var notificationToShow = NotificationStorage.getNextToShow(stringifyURL(new
URL(details.url))); | 112 var notificationToShow = NotificationStorage.getNextToShow(stringifyURL(new
URL(details.url))); |
| 110 if (notificationToShow) | 113 if (notificationToShow) |
| 111 showNotification(notificationToShow); | 114 showNotification(notificationToShow); |
| 112 } | 115 } |
| 113 | 116 |
| 114 chrome.webRequest.onHeadersReceived.addListener(onHeadersReceived, {urls: ["ht
tp://*/*", "https://*/*"]}, ["responseHeaders"]); | 117 chrome.webRequest.onHeadersReceived.addListener(onHeadersReceived, {urls: ["ht
tp://*/*", "https://*/*"]}, ["responseHeaders"]); |
| 115 } | 118 } |
| OLD | NEW |