Left: | ||
Right: |
OLD | NEW |
---|---|
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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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) || 0; |
221 if ("downloadCount" in obj) | |
222 result.downloadCount = parseInt(obj.downloadCount) || 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.
| |
221 } | 223 } |
222 catch (e) | 224 catch (e) |
223 { | 225 { |
224 // Invalid URL - custom filter group | 226 // Invalid URL - custom filter group |
225 if (!("title" in obj)) | 227 if (!("title" in obj)) |
226 { | 228 { |
227 // Backwards compatibility - titles and filter types were originally | 229 // Backwards compatibility - titles and filter types were originally |
228 // determined by group identifier. | 230 // determined by group identifier. |
229 if (obj.url == "~wl~") | 231 if (obj.url == "~wl~") |
230 obj.defaults = "whitelist"; | 232 obj.defaults = "whitelist"; |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
553 * Minimal Adblock Plus version required for this subscription | 555 * Minimal Adblock Plus version required for this subscription |
554 * @type String | 556 * @type String |
555 */ | 557 */ |
556 requiredVersion: null, | 558 requiredVersion: null, |
557 | 559 |
558 /** | 560 /** |
559 * Should be true if requiredVersion is higher than current Adblock Plus versi on | 561 * Should be true if requiredVersion is higher than current Adblock Plus versi on |
560 * @type Boolean | 562 * @type Boolean |
561 */ | 563 */ |
562 upgradeRequired: false, | 564 upgradeRequired: false, |
565 | |
566 /** | |
567 * Number indicating how often the object was downloaded. | |
568 * @type Number | |
569 */ | |
570 downloadCount: 0, | |
563 | 571 |
564 /** | 572 /** |
565 * See Subscription.serialize() | 573 * See Subscription.serialize() |
566 */ | 574 */ |
567 serialize: function(buffer) | 575 serialize: function(buffer) |
568 { | 576 { |
569 RegularSubscription.prototype.serialize.call(this, buffer); | 577 RegularSubscription.prototype.serialize.call(this, buffer); |
570 if (this.downloadStatus) | 578 if (this.downloadStatus) |
571 buffer.push("downloadStatus=" + this.downloadStatus); | 579 buffer.push("downloadStatus=" + this.downloadStatus); |
572 if (this.lastSuccess) | 580 if (this.lastSuccess) |
573 buffer.push("lastSuccess=" + this.lastSuccess); | 581 buffer.push("lastSuccess=" + this.lastSuccess); |
574 if (this.lastCheck) | 582 if (this.lastCheck) |
575 buffer.push("lastCheck=" + this.lastCheck); | 583 buffer.push("lastCheck=" + this.lastCheck); |
576 if (this.expires) | 584 if (this.expires) |
577 buffer.push("expires=" + this.expires); | 585 buffer.push("expires=" + this.expires); |
578 if (this.softExpiration) | 586 if (this.softExpiration) |
579 buffer.push("softExpiration=" + this.softExpiration); | 587 buffer.push("softExpiration=" + this.softExpiration); |
580 if (this.errors) | 588 if (this.errors) |
581 buffer.push("errors=" + this.errors); | 589 buffer.push("errors=" + this.errors); |
582 if (this.version) | 590 if (this.version) |
583 buffer.push("version=" + this.version); | 591 buffer.push("version=" + this.version); |
584 if (this.requiredVersion) | 592 if (this.requiredVersion) |
585 buffer.push("requiredVersion=" + this.requiredVersion); | 593 buffer.push("requiredVersion=" + this.requiredVersion); |
594 if (this.downloadCount) | |
595 buffer.push("downloadCount=" + this.downloadCount); | |
586 } | 596 } |
587 }; | 597 }; |
OLD | NEW |