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 platform = require("info").platform; | 20 var platform = require("info").platform; |
20 | 21 |
21 var onFilterChangeTimeout = null; | 22 var onFilterChangeTimeout = null; |
22 function onFilterChange() | 23 function onFilterChange() |
23 { | 24 { |
24 onFilterChangeTimeout = null; | 25 onFilterChangeTimeout = null; |
25 ext.webRequest.handlerBehaviorChanged(); | 26 ext.webRequest.handlerBehaviorChanged(); |
26 } | 27 } |
27 | 28 |
28 var importantNotifications = { | 29 var importantNotifications = { |
29 'filter.added': true, | 30 'filter.added': true, |
30 'filter.removed': true, | 31 'filter.removed': true, |
31 'filter.disabled': true, | 32 'filter.disabled': true, |
32 'subscription.added': true, | 33 'subscription.added': true, |
33 'subscription.removed': true, | 34 'subscription.removed': true, |
34 'subscription.disabled': true, | 35 'subscription.disabled': true, |
35 'subscription.updated': true, | 36 'subscription.updated': true, |
36 'load': true | 37 'load': true |
37 }; | 38 }; |
38 | 39 |
| 40 ext.webRequest.indistinguishableTypes.forEach(function(types) |
| 41 { |
| 42 for (var i = 1; i < types.length; i++) |
| 43 RegExpFilter.typeMap[types[i]] = RegExpFilter.typeMap[types[0]]; |
| 44 }); |
| 45 |
39 FilterNotifier.addListener(function(action) | 46 FilterNotifier.addListener(function(action) |
40 { | 47 { |
41 if (action in importantNotifications) | 48 if (action in importantNotifications) |
42 { | 49 { |
43 // Execute delayed to prevent multiple executions in a quick succession | 50 // Execute delayed to prevent multiple executions in a quick succession |
44 if (onFilterChangeTimeout != null) | 51 if (onFilterChangeTimeout != null) |
45 window.clearTimeout(onFilterChangeTimeout); | 52 window.clearTimeout(onFilterChangeTimeout); |
46 onFilterChangeTimeout = window.setTimeout(onFilterChange, 2000); | 53 onFilterChangeTimeout = window.setTimeout(onFilterChange, 2000); |
47 } | 54 } |
48 }); | 55 }); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 processKey(header.value, page, frame); | 106 processKey(header.value, page, frame); |
100 } | 107 } |
101 | 108 |
102 var notificationToShow = NotificationStorage.getNextToShow(stringifyURL(new
URL(details.url))); | 109 var notificationToShow = NotificationStorage.getNextToShow(stringifyURL(new
URL(details.url))); |
103 if (notificationToShow) | 110 if (notificationToShow) |
104 showNotification(notificationToShow); | 111 showNotification(notificationToShow); |
105 } | 112 } |
106 | 113 |
107 chrome.webRequest.onHeadersReceived.addListener(onHeadersReceived, {urls: ["ht
tp://*/*", "https://*/*"]}, ["responseHeaders"]); | 114 chrome.webRequest.onHeadersReceived.addListener(onHeadersReceived, {urls: ["ht
tp://*/*", "https://*/*"]}, ["responseHeaders"]); |
108 } | 115 } |
OLD | NEW |