Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 /* | 1 /* |
2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
3 * Copyright (C) 2006-2014 Eyeo GmbH | 3 * Copyright (C) 2006-2014 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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
189 let result; | 189 let result; |
190 try | 190 try |
191 { | 191 { |
192 obj.url = Services.io.newURI(obj.url, null, null).spec; | 192 obj.url = Services.io.newURI(obj.url, null, null).spec; |
193 | 193 |
194 // URL is valid - this is a downloadable subscription | 194 // URL is valid - this is a downloadable subscription |
195 result = new DownloadableSubscription(obj.url, obj.title); | 195 result = new DownloadableSubscription(obj.url, obj.title); |
196 if ("downloadStatus" in obj) | 196 if ("downloadStatus" in obj) |
197 result._downloadStatus = obj.downloadStatus; | 197 result._downloadStatus = obj.downloadStatus; |
198 if ("lastSuccess" in obj) | 198 if ("lastSuccess" in obj) |
199 result.lastSuccess = parseInt(obj.lastSuccess) || 0; | 199 result.lastSuccess = parseInt(obj.lastSuccess, 10) || 0; |
200 if ("lastCheck" in obj) | 200 if ("lastCheck" in obj) |
201 result._lastCheck = parseInt(obj.lastCheck) || 0; | 201 result._lastCheck = parseInt(obj.lastCheck, 10) || 0; |
202 if ("expires" in obj) | 202 if ("expires" in obj) |
203 result.expires = parseInt(obj.expires) || 0; | 203 result.expires = parseInt(obj.expires, 10) || 0; |
204 if ("softExpiration" in obj) | 204 if ("softExpiration" in obj) |
205 result.softExpiration = parseInt(obj.softExpiration) || 0; | 205 result.softExpiration = parseInt(obj.softExpiration, 10) || 0; |
206 if ("errors" in obj) | 206 if ("errors" in obj) |
207 result._errors = parseInt(obj.errors) || 0; | 207 result._errors = parseInt(obj.errors, 10) || 0; |
208 if ("version" in obj) | 208 if ("version" in obj) |
209 result.version = parseInt(obj.version) || 0; | 209 result.version = parseInt(obj.version, 10) || 0; |
210 if ("requiredVersion" in obj) | 210 if ("requiredVersion" in obj) |
211 { | 211 { |
212 let {addonVersion} = require("info"); | 212 let {addonVersion} = require("info"); |
213 result.requiredVersion = obj.requiredVersion; | 213 result.requiredVersion = obj.requiredVersion; |
214 if (Services.vc.compare(result.requiredVersion, addonVersion) > 0) | 214 if (Services.vc.compare(result.requiredVersion, addonVersion) > 0) |
215 result.upgradeRequired = true; | 215 result.upgradeRequired = true; |
216 } | 216 } |
217 if ("homepage" in obj) | 217 if ("homepage" in obj) |
218 result._homepage = obj.homepage; | 218 result._homepage = obj.homepage; |
219 if ("lastDownload" in obj) | 219 if ("lastDownload" in obj) |
220 result._lastDownload = parseInt(obj.lastDownload) || 0; | 220 result._lastDownload = parseInt(obj.lastDownload, 10) || 0; |
221 if ("downloadCount" in obj) | 221 if ("downloadCount" in obj) |
222 result.downloadCount = parseInt(obj.downloadCount) || 0; | 222 result.downloadCount = parseInt(obj.downloadCount, 10) || 0; |
Wladimir Palant
2014/11/11 17:28:16
Nit: while at it, could you change that into parse
Thomas Greiner
2014/11/11 17:53:18
No problem. Done.
| |
223 } | 223 } |
224 catch (e) | 224 catch (e) |
225 { | 225 { |
226 // Invalid URL - custom filter group | 226 // Invalid URL - custom filter group |
227 if (!("title" in obj)) | 227 if (!("title" in obj)) |
228 { | 228 { |
229 // Backwards compatibility - titles and filter types were originally | 229 // Backwards compatibility - titles and filter types were originally |
230 // determined by group identifier. | 230 // determined by group identifier. |
231 if (obj.url == "~wl~") | 231 if (obj.url == "~wl~") |
232 obj.defaults = "whitelist"; | 232 obj.defaults = "whitelist"; |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
588 if (this.errors) | 588 if (this.errors) |
589 buffer.push("errors=" + this.errors); | 589 buffer.push("errors=" + this.errors); |
590 if (this.version) | 590 if (this.version) |
591 buffer.push("version=" + this.version); | 591 buffer.push("version=" + this.version); |
592 if (this.requiredVersion) | 592 if (this.requiredVersion) |
593 buffer.push("requiredVersion=" + this.requiredVersion); | 593 buffer.push("requiredVersion=" + this.requiredVersion); |
594 if (this.downloadCount) | 594 if (this.downloadCount) |
595 buffer.push("downloadCount=" + this.downloadCount); | 595 buffer.push("downloadCount=" + this.downloadCount); |
596 } | 596 } |
597 }; | 597 }; |
LEFT | RIGHT |