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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 _getDownloadable: function(/**Subscription*/ subscription, /**Boolean*/ manual
) /**Downloadable*/ | 106 _getDownloadable: function(/**Subscription*/ subscription, /**Boolean*/ manual
) /**Downloadable*/ |
107 { | 107 { |
108 let result = new Downloadable(subscription.url); | 108 let result = new Downloadable(subscription.url); |
109 if (subscription.lastDownload != subscription.lastSuccess) | 109 if (subscription.lastDownload != subscription.lastSuccess) |
110 result.lastError = subscription.lastDownload * MILLIS_IN_SECOND; | 110 result.lastError = subscription.lastDownload * MILLIS_IN_SECOND; |
111 result.lastCheck = subscription.lastCheck * MILLIS_IN_SECOND; | 111 result.lastCheck = subscription.lastCheck * MILLIS_IN_SECOND; |
112 result.lastVersion = subscription.version; | 112 result.lastVersion = subscription.version; |
113 result.softExpiration = subscription.softExpiration * MILLIS_IN_SECOND; | 113 result.softExpiration = subscription.softExpiration * MILLIS_IN_SECOND; |
114 result.hardExpiration = subscription.expires * MILLIS_IN_SECOND; | 114 result.hardExpiration = subscription.expires * MILLIS_IN_SECOND; |
115 result.manual = manual; | 115 result.manual = manual; |
| 116 result.downloadCount = subscription.downloadCount; |
116 return result; | 117 return result; |
117 }, | 118 }, |
118 | 119 |
119 _onExpirationChange: function(downloadable) | 120 _onExpirationChange: function(downloadable) |
120 { | 121 { |
121 let subscription = Subscription.fromURL(downloadable.url); | 122 let subscription = Subscription.fromURL(downloadable.url); |
122 subscription.lastCheck = Math.round(downloadable.lastCheck / MILLIS_IN_SECON
D); | 123 subscription.lastCheck = Math.round(downloadable.lastCheck / MILLIS_IN_SECON
D); |
123 subscription.softExpiration = Math.round(downloadable.softExpiration / MILLI
S_IN_SECOND); | 124 subscription.softExpiration = Math.round(downloadable.softExpiration / MILLI
S_IN_SECOND); |
124 subscription.expires = Math.round(downloadable.hardExpiration / MILLIS_IN_SE
COND); | 125 subscription.expires = Math.round(downloadable.hardExpiration / MILLIS_IN_SE
COND); |
125 }, | 126 }, |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 | 189 |
189 delete Subscription.knownSubscriptions[oldSubscription.url]; | 190 delete Subscription.knownSubscriptions[oldSubscription.url]; |
190 | 191 |
191 if (listed) | 192 if (listed) |
192 FilterStorage.addSubscription(subscription); | 193 FilterStorage.addSubscription(subscription); |
193 } | 194 } |
194 | 195 |
195 // The download actually succeeded | 196 // The download actually succeeded |
196 subscription.lastSuccess = subscription.lastDownload = Math.round(Date.now()
/ MILLIS_IN_SECOND); | 197 subscription.lastSuccess = subscription.lastDownload = Math.round(Date.now()
/ MILLIS_IN_SECOND); |
197 subscription.downloadStatus = "synchronize_ok"; | 198 subscription.downloadStatus = "synchronize_ok"; |
| 199 subscription.downloadCount = downloadable.downloadCount; |
198 subscription.errors = 0; | 200 subscription.errors = 0; |
199 | 201 |
200 // Remove lines containing parameters | 202 // Remove lines containing parameters |
201 for (let i = remove.length - 1; i >= 0; i--) | 203 for (let i = remove.length - 1; i >= 0; i--) |
202 lines.splice(remove[i], 1); | 204 lines.splice(remove[i], 1); |
203 | 205 |
204 // Process parameters | 206 // Process parameters |
205 if (params.homepage) | 207 if (params.homepage) |
206 { | 208 { |
207 let uri = Utils.makeURI(params.homepage); | 209 let uri = Utils.makeURI(params.homepage); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 let data = "[Adblock]\n" + subscription.filters.map((f) => f.text).j
oin("\n"); | 311 let data = "[Adblock]\n" + subscription.filters.map((f) => f.text).j
oin("\n"); |
310 redirectCallback("data:text/plain," + encodeURIComponent(data)); | 312 redirectCallback("data:text/plain," + encodeURIComponent(data)); |
311 } | 313 } |
312 }, false); | 314 }, false); |
313 request.send(null); | 315 request.send(null); |
314 } | 316 } |
315 } | 317 } |
316 }, | 318 }, |
317 }; | 319 }; |
318 Synchronizer.init(); | 320 Synchronizer.init(); |
OLD | NEW |