OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
3 * Copyright (C) 2006-2014 Eyeo GmbH | 3 * Copyright (C) 2006-2014 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 if (typeof Prefs.notificationdata.lastError === "number") | 100 if (typeof Prefs.notificationdata.lastError === "number") |
101 downloadable.lastError = Prefs.notificationdata.lastError; | 101 downloadable.lastError = Prefs.notificationdata.lastError; |
102 if (typeof Prefs.notificationdata.lastCheck === "number") | 102 if (typeof Prefs.notificationdata.lastCheck === "number") |
103 downloadable.lastCheck = Prefs.notificationdata.lastCheck; | 103 downloadable.lastCheck = Prefs.notificationdata.lastCheck; |
104 if (typeof Prefs.notificationdata.data === "object" && "version" in Prefs.no
tificationdata.data) | 104 if (typeof Prefs.notificationdata.data === "object" && "version" in Prefs.no
tificationdata.data) |
105 downloadable.lastVersion = Prefs.notificationdata.data.version; | 105 downloadable.lastVersion = Prefs.notificationdata.data.version; |
106 if (typeof Prefs.notificationdata.softExpiration === "number") | 106 if (typeof Prefs.notificationdata.softExpiration === "number") |
107 downloadable.softExpiration = Prefs.notificationdata.softExpiration; | 107 downloadable.softExpiration = Prefs.notificationdata.softExpiration; |
108 if (typeof Prefs.notificationdata.hardExpiration === "number") | 108 if (typeof Prefs.notificationdata.hardExpiration === "number") |
109 downloadable.hardExpiration = Prefs.notificationdata.hardExpiration; | 109 downloadable.hardExpiration = Prefs.notificationdata.hardExpiration; |
| 110 if (typeof Prefs.notificationdata.downloadCount === "number") |
| 111 downloadable.downloadCount = Prefs.notificationdata.downloadCount; |
110 yield downloadable; | 112 yield downloadable; |
111 }, | 113 }, |
112 | 114 |
113 _onExpirationChange: function(downloadable) | 115 _onExpirationChange: function(downloadable) |
114 { | 116 { |
115 Prefs.notificationdata.lastCheck = downloadable.lastCheck; | 117 Prefs.notificationdata.lastCheck = downloadable.lastCheck; |
116 Prefs.notificationdata.softExpiration = downloadable.softExpiration; | 118 Prefs.notificationdata.softExpiration = downloadable.softExpiration; |
117 Prefs.notificationdata.hardExpiration = downloadable.hardExpiration; | 119 Prefs.notificationdata.hardExpiration = downloadable.hardExpiration; |
118 saveNotificationData(); | 120 saveNotificationData(); |
119 }, | 121 }, |
(...skipping 17 matching lines...) Expand all Loading... |
137 catch (e) | 139 catch (e) |
138 { | 140 { |
139 Cu.reportError(e); | 141 Cu.reportError(e); |
140 errorCallback("synchronize_invalid_data"); | 142 errorCallback("synchronize_invalid_data"); |
141 return; | 143 return; |
142 } | 144 } |
143 | 145 |
144 Prefs.notificationdata.lastError = 0; | 146 Prefs.notificationdata.lastError = 0; |
145 Prefs.notificationdata.downloadStatus = "synchronize_ok"; | 147 Prefs.notificationdata.downloadStatus = "synchronize_ok"; |
146 [Prefs.notificationdata.softExpiration, Prefs.notificationdata.hardExpiratio
n] = downloader.processExpirationInterval(EXPIRATION_INTERVAL); | 148 [Prefs.notificationdata.softExpiration, Prefs.notificationdata.hardExpiratio
n] = downloader.processExpirationInterval(EXPIRATION_INTERVAL); |
| 149 Prefs.notificationdata.downloadCount = downloadable.downloadCount; |
147 saveNotificationData(); | 150 saveNotificationData(); |
148 }, | 151 }, |
149 | 152 |
150 _onDownloadError: function(downloadable, downloadURL, error, channelStatus, re
sponseStatus, redirectCallback) | 153 _onDownloadError: function(downloadable, downloadURL, error, channelStatus, re
sponseStatus, redirectCallback) |
151 { | 154 { |
152 Prefs.notificationdata.lastError = Date.now(); | 155 Prefs.notificationdata.lastError = Date.now(); |
153 Prefs.notificationdata.downloadStatus = error; | 156 Prefs.notificationdata.downloadStatus = error; |
154 saveNotificationData(); | 157 saveNotificationData(); |
155 }, | 158 }, |
156 | 159 |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 triggerQuestionListeners: function(id, approved) | 328 triggerQuestionListeners: function(id, approved) |
326 { | 329 { |
327 if (!(id in listeners)) | 330 if (!(id in listeners)) |
328 return; | 331 return; |
329 let questionListeners = listeners[id]; | 332 let questionListeners = listeners[id]; |
330 for (let listener of questionListeners) | 333 for (let listener of questionListeners) |
331 listener(approved); | 334 listener(approved); |
332 } | 335 } |
333 }; | 336 }; |
334 Notification.init(); | 337 Notification.init(); |
OLD | NEW |