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-present eyeo GmbH | 3 * Copyright (C) 2006-present 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 downloadable.softExpiration / MILLIS_IN_SECOND | 135 downloadable.softExpiration / MILLIS_IN_SECOND |
136 ); | 136 ); |
137 subscription.expires = Math.round( | 137 subscription.expires = Math.round( |
138 downloadable.hardExpiration / MILLIS_IN_SECOND | 138 downloadable.hardExpiration / MILLIS_IN_SECOND |
139 ); | 139 ); |
140 }, | 140 }, |
141 | 141 |
142 _onDownloadStarted(downloadable) | 142 _onDownloadStarted(downloadable) |
143 { | 143 { |
144 let subscription = Subscription.fromURL(downloadable.url); | 144 let subscription = Subscription.fromURL(downloadable.url); |
145 FilterNotifier.triggerListeners("subscription.downloading", subscription); | 145 FilterNotifier.emit("subscription.downloading", subscription); |
146 }, | 146 }, |
147 | 147 |
148 _onDownloadSuccess(downloadable, responseText, errorCallback, | 148 _onDownloadSuccess(downloadable, responseText, errorCallback, |
149 redirectCallback) | 149 redirectCallback) |
150 { | 150 { |
151 let lines = responseText.split(/[\r\n]+/); | 151 let lines = responseText.split(/[\r\n]+/); |
152 let headerMatch = /\[Adblock(?:\s*Plus\s*([\d.]+)?)?\]/i.exec(lines[0]); | 152 let headerMatch = /\[Adblock(?:\s*Plus\s*([\d.]+)?)?\]/i.exec(lines[0]); |
153 if (!headerMatch) | 153 if (!headerMatch) |
154 return errorCallback("synchronize_invalid_data"); | 154 return errorCallback("synchronize_invalid_data"); |
155 let minVersion = headerMatch[1]; | 155 let minVersion = headerMatch[1]; |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 subscription.filters.map(f => f.text).join("\n"); | 348 subscription.filters.map(f => f.text).join("\n"); |
349 redirectCallback("data:text/plain," + encodeURIComponent(data)); | 349 redirectCallback("data:text/plain," + encodeURIComponent(data)); |
350 } | 350 } |
351 }, false); | 351 }, false); |
352 request.send(null); | 352 request.send(null); |
353 } | 353 } |
354 } | 354 } |
355 } | 355 } |
356 }; | 356 }; |
357 Synchronizer.init(); | 357 Synchronizer.init(); |
OLD | NEW |