Index: lib/synchronizer.js |
=================================================================== |
--- a/lib/synchronizer.js |
+++ b/lib/synchronizer.js |
@@ -140,27 +140,24 @@ |
{ |
let subscription = Subscription.fromURL(downloadable.url); |
FilterNotifier.triggerListeners("subscription.downloading", subscription); |
}, |
_onDownloadSuccess(downloadable, responseText, errorCallback, |
redirectCallback) |
{ |
- let lines = responseText.split(/[\r\n]+/); |
- let headerMatch = /\[Adblock(?:\s*Plus\s*([\d.]+)?)?\]/i.exec(lines[0]); |
- if (!headerMatch) |
- return errorCallback("synchronize_invalid_data"); |
- let minVersion = headerMatch[1]; |
- |
let parser = DownloadableSubscription.parseDownload(); |
- // Process filters |
- for (let line of lines) |
- parser.process(line); |
+ if (!parser.process(responseText)) |
+ { |
+ let {error} = parser; |
+ parser.delete(); |
+ return errorCallback(error); |
+ } |
if (!parser.verifyChecksum()) |
return errorCallback("synchronize_checksum_mismatch"); |
if (parser.redirect) |
{ |
let {redirect} = parser; |
parser.delete(); |
@@ -206,21 +203,16 @@ |
{ |
url = null; |
} |
if (url && (url.protocol == "http:" || url.protocol == "https:")) |
subscription.homepage = url.href; |
} |
- if (minVersion) |
- subscription.requiredVersion = minVersion; |
- else |
- delete subscription.requiredVersion; |
- |
let expirationInterval = DEFAULT_EXPIRATION_INTERVAL; |
let expiration = parser.finalize(subscription); |
if (expiration != 0) |
expirationInterval = expiration; |
let [ |
softExpiration, |
hardExpiration |