| 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 |
| (...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) |
| 40 { |
| 41 return null; |
| 42 } |
| 39 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); |
| 40 let downloadable = new Downloadable(url); | 44 let downloadable = new Downloadable(url); |
| 41 downloadable.lastError = Prefs.update_last_error; | 45 downloadable.lastError = Prefs.update_last_error; |
| 42 downloadable.lastCheck = Prefs.update_last_check; | 46 downloadable.lastCheck = Prefs.update_last_check; |
| 43 downloadable.softExpiration = Prefs.update_soft_expiration; | 47 downloadable.softExpiration = Prefs.update_soft_expiration; |
| 44 downloadable.hardExpiration = Prefs.update_hard_expiration; | 48 downloadable.hardExpiration = Prefs.update_hard_expiration; |
| 45 return downloadable; | 49 return downloadable; |
| 46 } | 50 } |
| 47 | 51 |
| 48 function getDownloadables() | 52 function getDownloadables() |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 if (callback) | 100 if (callback) |
| 97 callback(error); | 101 callback(error); |
| 98 callback = null; | 102 callback = null; |
| 99 } | 103 } |
| 100 | 104 |
| 101 let checkForUpdates = exports.checkForUpdates = function checkForUpdates(_callba
ck) | 105 let checkForUpdates = exports.checkForUpdates = function checkForUpdates(_callba
ck) |
| 102 { | 106 { |
| 103 callback = _callback; | 107 callback = _callback; |
| 104 downloader.download(getDownloadable(true)); | 108 downloader.download(getDownloadable(true)); |
| 105 } | 109 } |
| OLD | NEW |