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 |
(...skipping 18 matching lines...) Expand all Loading... |
29 const TYPE_AUTOMATIC = 0; | 29 const TYPE_AUTOMATIC = 0; |
30 const TYPE_MANUAL = 1; | 30 const TYPE_MANUAL = 1; |
31 | 31 |
32 let downloader = new Downloader(getDownloadables, INITIAL_DELAY, CHECK_INTERVAL)
; | 32 let downloader = new Downloader(getDownloadables, INITIAL_DELAY, CHECK_INTERVAL)
; |
33 downloader.onExpirationChange = onExpirationChange; | 33 downloader.onExpirationChange = onExpirationChange; |
34 downloader.onDownloadSuccess = onDownloadSuccess; | 34 downloader.onDownloadSuccess = onDownloadSuccess; |
35 downloader.onDownloadError = onDownloadError; | 35 downloader.onDownloadError = onDownloadError; |
36 | 36 |
37 function getDownloadable(forceCheck) | 37 function getDownloadable(forceCheck) |
38 { | 38 { |
39 if (!forceCheck && Pref.disable_auto_updates) | 39 if (!forceCheck && Prefs.disable_auto_updates) |
40 { | 40 { |
41 return null; | 41 return null; |
42 } | 42 } |
43 let url = updateUrl.replace(/%TYPE%/g, forceCheck ? TYPE_MANUAL : TYPE_AUTOMAT
IC); | 43 let url = updateUrl.replace(/%TYPE%/g, forceCheck ? TYPE_MANUAL : TYPE_AUTOMAT
IC); |
44 let downloadable = new Downloadable(url); | 44 let downloadable = new Downloadable(url); |
45 downloadable.lastError = Prefs.update_last_error; | 45 downloadable.lastError = Prefs.update_last_error; |
46 downloadable.lastCheck = Prefs.update_last_check; | 46 downloadable.lastCheck = Prefs.update_last_check; |
47 downloadable.softExpiration = Prefs.update_soft_expiration; | 47 downloadable.softExpiration = Prefs.update_soft_expiration; |
48 downloadable.hardExpiration = Prefs.update_hard_expiration; | 48 downloadable.hardExpiration = Prefs.update_hard_expiration; |
49 return downloadable; | 49 return downloadable; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 if (callback) | 100 if (callback) |
101 callback(error); | 101 callback(error); |
102 callback = null; | 102 callback = null; |
103 } | 103 } |
104 | 104 |
105 let checkForUpdates = exports.checkForUpdates = function checkForUpdates(_callba
ck) | 105 let checkForUpdates = exports.checkForUpdates = function checkForUpdates(_callba
ck) |
106 { | 106 { |
107 callback = _callback; | 107 callback = _callback; |
108 downloader.download(getDownloadable(true)); | 108 downloader.download(getDownloadable(true)); |
109 } | 109 } |
OLD | NEW |