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-2016 Eyeo GmbH | 3 * Copyright (C) 2006-2016 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 "use strict"; |
| 19 |
18 /** | 20 /** |
19 * @fileOverview Downloads a set of URLs in regular time intervals. | 21 * @fileOverview Downloads a set of URLs in regular time intervals. |
20 */ | 22 */ |
21 | 23 |
22 let {Utils} = require("utils"); | 24 const {Utils} = require("utils"); |
23 | 25 |
24 let MILLIS_IN_SECOND = exports.MILLIS_IN_SECOND = 1000; | 26 const MILLIS_IN_SECOND = exports.MILLIS_IN_SECOND = 1000; |
25 let MILLIS_IN_MINUTE = exports.MILLIS_IN_MINUTE = 60 * MILLIS_IN_SECOND; | 27 const MILLIS_IN_MINUTE = exports.MILLIS_IN_MINUTE = 60 * MILLIS_IN_SECOND; |
26 let MILLIS_IN_HOUR = exports.MILLIS_IN_HOUR = 60 * MILLIS_IN_MINUTE; | 28 const MILLIS_IN_HOUR = exports.MILLIS_IN_HOUR = 60 * MILLIS_IN_MINUTE; |
27 let MILLIS_IN_DAY = exports.MILLIS_IN_DAY = 24 * MILLIS_IN_HOUR; | 29 const MILLIS_IN_DAY = exports.MILLIS_IN_DAY = 24 * MILLIS_IN_HOUR; |
28 | 30 |
| 31 let Downloader = |
29 /** | 32 /** |
30 * Creates a new downloader instance. | 33 * Creates a new downloader instance. |
31 * @param {Function} dataSource Function that will yield downloadable objects o
n each check | 34 * @param {Function} dataSource |
32 * @param {Integer} initialDelay Number of milliseconds to wait before the firs
t check | 35 * Function that will yield downloadable objects on each check |
33 * @param {Integer} checkInterval Interval between the checks | 36 * @param {number} initialDelay |
| 37 * Number of milliseconds to wait before the first check |
| 38 * @param {number} checkInterval |
| 39 * Interval between the checks |
34 * @constructor | 40 * @constructor |
35 */ | 41 */ |
36 let Downloader = exports.Downloader = function Downloader(dataSource, initialDel
ay, checkInterval) | 42 exports.Downloader = function(dataSource, initialDelay, checkInterval) |
37 { | 43 { |
38 this.dataSource = dataSource; | 44 this.dataSource = dataSource; |
39 this._timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer); | 45 this._timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer); |
40 this._timer.initWithCallback(function() | 46 this._timer.initWithCallback(() => |
41 { | 47 { |
42 this._timer.delay = checkInterval; | 48 this._timer.delay = checkInterval; |
43 this._doCheck(); | 49 this._doCheck(); |
44 }.bind(this), initialDelay, Ci.nsITimer.TYPE_REPEATING_SLACK); | 50 }, initialDelay, Ci.nsITimer.TYPE_REPEATING_SLACK); |
45 this._downloading = Object.create(null); | 51 this._downloading = Object.create(null); |
46 } | 52 }; |
47 Downloader.prototype = | 53 Downloader.prototype = |
48 { | 54 { |
49 /** | 55 /** |
50 * Timer triggering the downloads. | 56 * Timer triggering the downloads. |
51 * @type nsITimer | 57 * @type {nsITimer} |
52 */ | 58 */ |
53 _timer: null, | 59 _timer: null, |
54 | 60 |
55 /** | 61 /** |
56 * Map containing the URLs of objects currently being downloaded as its keys. | 62 * Map containing the URLs of objects currently being downloaded as its keys. |
57 */ | 63 */ |
58 _downloading: null, | 64 _downloading: null, |
59 | 65 |
60 /** | 66 /** |
61 * Function that will yield downloadable objects on each check. | 67 * Function that will yield downloadable objects on each check. |
62 * @type Function | 68 * @type {Function} |
63 */ | 69 */ |
64 dataSource: null, | 70 dataSource: null, |
65 | 71 |
66 /** | 72 /** |
67 * Maximal time interval that the checks can be left out until the soft | 73 * Maximal time interval that the checks can be left out until the soft |
68 * expiration interval increases. | 74 * expiration interval increases. |
69 * @type Integer | 75 * @type {number} |
70 */ | 76 */ |
71 maxAbsenceInterval: 1 * MILLIS_IN_DAY, | 77 maxAbsenceInterval: 1 * MILLIS_IN_DAY, |
72 | 78 |
73 /** | 79 /** |
74 * Minimal time interval before retrying a download after an error. | 80 * Minimal time interval before retrying a download after an error. |
75 * @type Integer | 81 * @type {number} |
76 */ | 82 */ |
77 minRetryInterval: 1 * MILLIS_IN_DAY, | 83 minRetryInterval: 1 * MILLIS_IN_DAY, |
78 | 84 |
79 /** | 85 /** |
80 * Maximal allowed expiration interval, larger expiration intervals will be | 86 * Maximal allowed expiration interval, larger expiration intervals will be |
81 * corrected. | 87 * corrected. |
82 * @type Integer | 88 * @type {number} |
83 */ | 89 */ |
84 maxExpirationInterval: 14 * MILLIS_IN_DAY, | 90 maxExpirationInterval: 14 * MILLIS_IN_DAY, |
85 | 91 |
86 /** | 92 /** |
87 * Maximal number of redirects before the download is considered as failed. | 93 * Maximal number of redirects before the download is considered as failed. |
88 * @type Integer | 94 * @type {number} |
89 */ | 95 */ |
90 maxRedirects: 5, | 96 maxRedirects: 5, |
91 | 97 |
92 /** | 98 /** |
93 * Called whenever expiration intervals for an object need to be adapted. | 99 * Called whenever expiration intervals for an object need to be adapted. |
94 * @type Function | 100 * @type {Function} |
95 */ | 101 */ |
96 onExpirationChange: null, | 102 onExpirationChange: null, |
97 | 103 |
98 /** | 104 /** |
99 * Callback to be triggered whenever a download starts. | 105 * Callback to be triggered whenever a download starts. |
100 * @type Function | 106 * @type {Function} |
101 */ | 107 */ |
102 onDownloadStarted: null, | 108 onDownloadStarted: null, |
103 | 109 |
104 /** | 110 /** |
105 * Callback to be triggered whenever a download finishes successfully. The | 111 * Callback to be triggered whenever a download finishes successfully. The |
106 * callback can return an error code to indicate that the data is wrong. | 112 * callback can return an error code to indicate that the data is wrong. |
107 * @type Function | 113 * @type {Function} |
108 */ | 114 */ |
109 onDownloadSuccess: null, | 115 onDownloadSuccess: null, |
110 | 116 |
111 /** | 117 /** |
112 * Callback to be triggered whenever a download fails. | 118 * Callback to be triggered whenever a download fails. |
113 * @type Function | 119 * @type {Function} |
114 */ | 120 */ |
115 onDownloadError: null, | 121 onDownloadError: null, |
116 | 122 |
117 /** | 123 /** |
118 * Checks whether anything needs downloading. | 124 * Checks whether anything needs downloading. |
119 */ | 125 */ |
120 _doCheck: function() | 126 _doCheck() |
121 { | 127 { |
122 let now = Date.now(); | 128 let now = Date.now(); |
123 for (let downloadable of this.dataSource()) | 129 for (let downloadable of this.dataSource()) |
124 { | 130 { |
125 if (downloadable.lastCheck && now - downloadable.lastCheck > this.maxAbsen
ceInterval) | 131 if (downloadable.lastCheck && |
| 132 now - downloadable.lastCheck > this.maxAbsenceInterval) |
126 { | 133 { |
127 // No checks for a long time interval - user must have been offline, e.g
. | 134 // No checks for a long time interval - user must have been offline, |
128 // during a weekend. Increase soft expiration to prevent load peaks on t
he | 135 // e.g. during a weekend. Increase soft expiration to prevent load |
129 // server. | 136 // peaks on the server. |
130 downloadable.softExpiration += now - downloadable.lastCheck; | 137 downloadable.softExpiration += now - downloadable.lastCheck; |
131 } | 138 } |
132 downloadable.lastCheck = now; | 139 downloadable.lastCheck = now; |
133 | 140 |
134 // Sanity check: do expiration times make sense? Make sure people changing | 141 // Sanity check: do expiration times make sense? Make sure people changing |
135 // system clock don't get stuck with outdated subscriptions. | 142 // system clock don't get stuck with outdated subscriptions. |
136 if (downloadable.hardExpiration - now > this.maxExpirationInterval) | 143 if (downloadable.hardExpiration - now > this.maxExpirationInterval) |
137 downloadable.hardExpiration = now + this.maxExpirationInterval; | 144 downloadable.hardExpiration = now + this.maxExpirationInterval; |
138 if (downloadable.softExpiration - now > this.maxExpirationInterval) | 145 if (downloadable.softExpiration - now > this.maxExpirationInterval) |
139 downloadable.softExpiration = now + this.maxExpirationInterval; | 146 downloadable.softExpiration = now + this.maxExpirationInterval; |
140 | 147 |
141 // Notify the caller about changes to expiration parameters | 148 // Notify the caller about changes to expiration parameters |
142 if (this.onExpirationChange) | 149 if (this.onExpirationChange) |
143 this.onExpirationChange(downloadable); | 150 this.onExpirationChange(downloadable); |
144 | 151 |
145 // Does that object need downloading? | 152 // Does that object need downloading? |
146 if (downloadable.softExpiration > now && downloadable.hardExpiration > now
) | 153 if (downloadable.softExpiration > now && |
| 154 downloadable.hardExpiration > now) |
| 155 { |
147 continue; | 156 continue; |
| 157 } |
148 | 158 |
149 // Do not retry downloads too often | 159 // Do not retry downloads too often |
150 if (downloadable.lastError && now - downloadable.lastError < this.minRetry
Interval) | 160 if (downloadable.lastError && |
| 161 now - downloadable.lastError < this.minRetryInterval) |
| 162 { |
151 continue; | 163 continue; |
| 164 } |
152 | 165 |
153 this._download(downloadable, 0); | 166 this._download(downloadable, 0); |
154 } | 167 } |
155 }, | 168 }, |
156 | 169 |
157 /** | 170 /** |
158 * Stops the periodic checks. | 171 * Stops the periodic checks. |
159 */ | 172 */ |
160 cancel: function() | 173 cancel() |
161 { | 174 { |
162 this._timer.cancel(); | 175 this._timer.cancel(); |
163 }, | 176 }, |
164 | 177 |
165 /** | 178 /** |
166 * Checks whether an address is currently being downloaded. | 179 * Checks whether an address is currently being downloaded. |
| 180 * @param {string} url |
| 181 * @return {boolean} |
167 */ | 182 */ |
168 isDownloading: function(/**String*/ url) /**Boolean*/ | 183 isDownloading(url) |
169 { | 184 { |
170 return url in this._downloading; | 185 return url in this._downloading; |
171 }, | 186 }, |
172 | 187 |
173 /** | 188 /** |
174 * Starts downloading for an object. | 189 * Starts downloading for an object. |
| 190 * @param {Downloadable} downloadable |
175 */ | 191 */ |
176 download: function(/**Downloadable*/ downloadable) | 192 download(downloadable) |
177 { | 193 { |
178 // Make sure to detach download from the current execution context | 194 // Make sure to detach download from the current execution context |
179 Utils.runAsync(this._download.bind(this, downloadable, 0)); | 195 Utils.runAsync(this._download.bind(this, downloadable, 0)); |
180 }, | 196 }, |
181 | 197 |
182 /** | 198 /** |
183 * Generates the real download URL for an object by appending various | 199 * Generates the real download URL for an object by appending various |
184 * parameters. | 200 * parameters. |
| 201 * @param {Downloadable} downloadable |
| 202 * @return {string} |
185 */ | 203 */ |
186 getDownloadUrl: function(/**Downloadable*/ downloadable) /** String*/ | 204 getDownloadUrl(downloadable) |
187 { | 205 { |
188 let {addonName, addonVersion, application, applicationVersion, platform, pla
tformVersion} = require("info"); | 206 const {addonName, addonVersion, application, applicationVersion, |
| 207 platform, platformVersion} = require("info"); |
189 let url = downloadable.redirectURL || downloadable.url; | 208 let url = downloadable.redirectURL || downloadable.url; |
190 if (url.indexOf("?") >= 0) | 209 if (url.indexOf("?") >= 0) |
191 url += "&"; | 210 url += "&"; |
192 else | 211 else |
193 url += "?"; | 212 url += "?"; |
194 // We limit the download count to 4+ to keep the request anonymized | 213 // We limit the download count to 4+ to keep the request anonymized |
195 let downloadCount = downloadable.downloadCount; | 214 let {downloadCount} = downloadable; |
196 if (downloadCount > 4) | 215 if (downloadCount > 4) |
197 downloadCount = "4+"; | 216 downloadCount = "4+"; |
198 url += "addonName=" + encodeURIComponent(addonName) + | 217 url += "addonName=" + encodeURIComponent(addonName) + |
199 "&addonVersion=" + encodeURIComponent(addonVersion) + | 218 "&addonVersion=" + encodeURIComponent(addonVersion) + |
200 "&application=" + encodeURIComponent(application) + | 219 "&application=" + encodeURIComponent(application) + |
201 "&applicationVersion=" + encodeURIComponent(applicationVersion) + | 220 "&applicationVersion=" + encodeURIComponent(applicationVersion) + |
202 "&platform=" + encodeURIComponent(platform) + | 221 "&platform=" + encodeURIComponent(platform) + |
203 "&platformVersion=" + encodeURIComponent(platformVersion) + | 222 "&platformVersion=" + encodeURIComponent(platformVersion) + |
204 "&lastVersion=" + encodeURIComponent(downloadable.lastVersion) + | 223 "&lastVersion=" + encodeURIComponent(downloadable.lastVersion) + |
205 "&downloadCount=" + encodeURIComponent(downloadCount); | 224 "&downloadCount=" + encodeURIComponent(downloadCount); |
206 return url; | 225 return url; |
207 }, | 226 }, |
208 | 227 |
209 _download: function(downloadable, redirects) | 228 _download(downloadable, redirects) |
210 { | 229 { |
211 if (this.isDownloading(downloadable.url)) | 230 if (this.isDownloading(downloadable.url)) |
212 return; | 231 return; |
213 | 232 |
214 let downloadUrl = this.getDownloadUrl(downloadable); | 233 let downloadUrl = this.getDownloadUrl(downloadable); |
215 let request = null; | 234 let request = null; |
216 | 235 |
217 let errorCallback = function errorCallback(error) | 236 let errorCallback = function errorCallback(error) |
218 { | 237 { |
219 let channelStatus = -1; | 238 let channelStatus = -1; |
220 try | 239 try |
221 { | 240 { |
222 channelStatus = request.channel.status; | 241 channelStatus = request.channel.status; |
223 } catch (e) {} | 242 } |
| 243 catch (e) {} |
224 | 244 |
225 let responseStatus = request.status; | 245 let responseStatus = request.status; |
226 | 246 |
227 Cu.reportError("Adblock Plus: Downloading URL " + downloadable.url + " fai
led (" + error + ")\n" + | 247 Cu.reportError("Adblock Plus: Downloading URL " + downloadable.url + |
| 248 " failed (" + error + ")\n" + |
228 "Download address: " + downloadUrl + "\n" + | 249 "Download address: " + downloadUrl + "\n" + |
229 "Channel status: " + channelStatus + "\n" + | 250 "Channel status: " + channelStatus + "\n" + |
230 "Server response: " + responseStatus); | 251 "Server response: " + responseStatus); |
231 | 252 |
232 if (this.onDownloadError) | 253 if (this.onDownloadError) |
233 { | 254 { |
234 // Allow one extra redirect if the error handler gives us a redirect URL | 255 // Allow one extra redirect if the error handler gives us a redirect URL |
235 let redirectCallback = null; | 256 let redirectCallback = null; |
236 if (redirects <= this.maxRedirects) | 257 if (redirects <= this.maxRedirects) |
237 { | 258 { |
238 redirectCallback = function redirectCallback(url) | 259 redirectCallback = url => |
239 { | 260 { |
240 downloadable.redirectURL = url; | 261 downloadable.redirectURL = url; |
241 this._download(downloadable, redirects + 1); | 262 this._download(downloadable, redirects + 1); |
242 }.bind(this); | 263 }; |
243 } | 264 } |
244 | 265 |
245 this.onDownloadError(downloadable, downloadUrl, error, channelStatus, re
sponseStatus, redirectCallback); | 266 this.onDownloadError(downloadable, downloadUrl, error, channelStatus, |
| 267 responseStatus, redirectCallback); |
246 } | 268 } |
247 }.bind(this); | 269 }.bind(this); |
248 | 270 |
249 try | 271 try |
250 { | 272 { |
251 request = new XMLHttpRequest(); | 273 request = new XMLHttpRequest(); |
252 request.mozBackgroundRequest = true; | 274 request.mozBackgroundRequest = true; |
253 request.open("GET", downloadUrl); | 275 request.open("GET", downloadUrl); |
254 } | 276 } |
255 catch (e) | 277 catch (e) |
256 { | 278 { |
257 errorCallback("synchronize_invalid_url"); | 279 errorCallback("synchronize_invalid_url"); |
258 return; | 280 return; |
259 } | 281 } |
260 | 282 |
261 try { | 283 try |
| 284 { |
262 request.overrideMimeType("text/plain"); | 285 request.overrideMimeType("text/plain"); |
263 request.channel.loadFlags = request.channel.loadFlags | | 286 request.channel.loadFlags = request.channel.loadFlags | |
264 request.channel.INHIBIT_CACHING | | 287 request.channel.INHIBIT_CACHING | |
265 request.channel.VALIDATE_ALWAYS; | 288 request.channel.VALIDATE_ALWAYS; |
266 | 289 |
267 // Override redirect limit from preferences, user might have set it to 1 | 290 // Override redirect limit from preferences, user might have set it to 1 |
268 if (request.channel instanceof Ci.nsIHttpChannel) | 291 if (request.channel instanceof Ci.nsIHttpChannel) |
269 request.channel.redirectionLimit = this.maxRedirects; | 292 request.channel.redirectionLimit = this.maxRedirects; |
270 } | 293 } |
271 catch (e) | 294 catch (e) |
272 { | 295 { |
273 Cu.reportError(e) | 296 Cu.reportError(e); |
274 } | 297 } |
275 | 298 |
276 request.addEventListener("error", function(event) | 299 request.addEventListener("error", event => |
277 { | 300 { |
278 if (onShutdown.done) | 301 if (onShutdown.done) |
279 return; | 302 return; |
280 | 303 |
281 delete this._downloading[downloadable.url]; | 304 delete this._downloading[downloadable.url]; |
282 errorCallback("synchronize_connection_error"); | 305 errorCallback("synchronize_connection_error"); |
283 }.bind(this), false); | 306 }, false); |
284 | 307 |
285 request.addEventListener("load", function(event) | 308 request.addEventListener("load", event => |
286 { | 309 { |
287 if (onShutdown.done) | 310 if (onShutdown.done) |
288 return; | 311 return; |
289 | 312 |
290 delete this._downloading[downloadable.url]; | 313 delete this._downloading[downloadable.url]; |
291 | 314 |
292 // Status will be 0 for non-HTTP requests | 315 // Status will be 0 for non-HTTP requests |
293 if (request.status && request.status != 200) | 316 if (request.status && request.status != 200) |
294 { | 317 { |
295 errorCallback("synchronize_connection_error"); | 318 errorCallback("synchronize_connection_error"); |
296 return; | 319 return; |
297 } | 320 } |
298 | 321 |
299 downloadable.downloadCount++; | 322 downloadable.downloadCount++; |
300 | 323 |
301 this.onDownloadSuccess(downloadable, request.responseText, errorCallback,
function redirectCallback(url) | 324 this.onDownloadSuccess( |
302 { | 325 downloadable, request.responseText, errorCallback, |
303 if (redirects >= this.maxRedirects) | 326 url => |
304 errorCallback("synchronize_connection_error"); | |
305 else | |
306 { | 327 { |
307 downloadable.redirectURL = url; | 328 if (redirects >= this.maxRedirects) |
308 this._download(downloadable, redirects + 1); | 329 errorCallback("synchronize_connection_error"); |
| 330 else |
| 331 { |
| 332 downloadable.redirectURL = url; |
| 333 this._download(downloadable, redirects + 1); |
| 334 } |
309 } | 335 } |
310 }.bind(this)); | 336 ); |
311 }.bind(this), false); | 337 }); |
312 | 338 |
313 request.send(null); | 339 request.send(null); |
314 | 340 |
315 this._downloading[downloadable.url] = true; | 341 this._downloading[downloadable.url] = true; |
316 if (this.onDownloadStarted) | 342 if (this.onDownloadStarted) |
317 this.onDownloadStarted(downloadable); | 343 this.onDownloadStarted(downloadable); |
318 }, | 344 }, |
319 | 345 |
320 /** | 346 /** |
321 * Produces a soft and a hard expiration interval for a given supplied | 347 * Produces a soft and a hard expiration interval for a given supplied |
322 * expiration interval. | 348 * expiration interval. |
| 349 * @param {number} interval |
323 * @return {Array} soft and hard expiration interval | 350 * @return {Array} soft and hard expiration interval |
324 */ | 351 */ |
325 processExpirationInterval: function(/**Integer*/ interval) | 352 processExpirationInterval(interval) |
326 { | 353 { |
327 interval = Math.min(Math.max(interval, 0), this.maxExpirationInterval); | 354 interval = Math.min(Math.max(interval, 0), this.maxExpirationInterval); |
328 let soft = Math.round(interval * (Math.random() * 0.4 + 0.8)); | 355 let soft = Math.round(interval * (Math.random() * 0.4 + 0.8)); |
329 let hard = interval * 2; | 356 let hard = interval * 2; |
330 let now = Date.now(); | 357 let now = Date.now(); |
331 return [now + soft, now + hard]; | 358 return [now + soft, now + hard]; |
332 } | 359 } |
333 }; | 360 }; |
334 | 361 |
335 /** | 362 /** |
336 * An object that can be downloaded by the downloadable | 363 * An object that can be downloaded by the downloadable |
337 * @param {String} url URL that has to be requested for the object | 364 * @param {string} url URL that has to be requested for the object |
338 * @constructor | 365 * @constructor |
339 */ | 366 */ |
340 let Downloadable = exports.Downloadable = function Downloadable(url) | 367 let Downloadable = exports.Downloadable = function Downloadable(url) |
341 { | 368 { |
342 this.url = url; | 369 this.url = url; |
343 } | 370 }; |
344 Downloadable.prototype = | 371 Downloadable.prototype = |
345 { | 372 { |
346 /** | 373 /** |
347 * URL that has to be requested for the object. | 374 * URL that has to be requested for the object. |
348 * @type String | 375 * @type {string} |
349 */ | 376 */ |
350 url: null, | 377 url: null, |
351 | 378 |
352 /** | 379 /** |
353 * URL that the download was redirected to if any. | 380 * URL that the download was redirected to if any. |
354 * @type String | 381 * @type {string} |
355 */ | 382 */ |
356 redirectURL: null, | 383 redirectURL: null, |
357 | 384 |
358 /** | 385 /** |
359 * Time of last download error or 0 if the last download was successful. | 386 * Time of last download error or 0 if the last download was successful. |
360 * @type Integer | 387 * @type {number} |
361 */ | 388 */ |
362 lastError: 0, | 389 lastError: 0, |
363 | 390 |
364 /** | 391 /** |
365 * Time of last check whether the object needs downloading. | 392 * Time of last check whether the object needs downloading. |
366 * @type Integer | 393 * @type {number} |
367 */ | 394 */ |
368 lastCheck: 0, | 395 lastCheck: 0, |
369 | 396 |
370 /** | 397 /** |
371 * Object version corresponding to the last successful download. | 398 * Object version corresponding to the last successful download. |
372 * @type Integer | 399 * @type {number} |
373 */ | 400 */ |
374 lastVersion: 0, | 401 lastVersion: 0, |
375 | 402 |
376 /** | 403 /** |
377 * Soft expiration interval, will increase if no checks are performed for a | 404 * Soft expiration interval, will increase if no checks are performed for a |
378 * while. | 405 * while. |
379 * @type Integer | 406 * @type {number} |
380 */ | 407 */ |
381 softExpiration: 0, | 408 softExpiration: 0, |
382 | 409 |
383 /** | 410 /** |
384 * Hard expiration interval, this is fixed. | 411 * Hard expiration interval, this is fixed. |
385 * @type Integer | 412 * @type {number} |
386 */ | 413 */ |
387 hardExpiration: 0, | 414 hardExpiration: 0, |
388 | 415 |
389 /** | 416 /** |
390 * Number indicating how often the object was downloaded. | 417 * Number indicating how often the object was downloaded. |
391 * @type Integer | 418 * @type {number} |
392 */ | 419 */ |
393 downloadCount: 0, | 420 downloadCount: 0 |
394 }; | 421 }; |
OLD | NEW |