Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/subscriptionClasses.js

Issue 11153017: Improve Synchronizer functionality (Closed)
Patch Set: Created July 17, 2013, 12:32 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: lib/subscriptionClasses.js
===================================================================
--- a/lib/subscriptionClasses.js
+++ b/lib/subscriptionClasses.js
@@ -179,41 +179,37 @@ Subscription.fromObject = function(obj)
{
let result;
try
{
obj.url = Services.io.newURI(obj.url, null, null).spec;
// URL is valid - this is a downloadable subscription
result = new DownloadableSubscription(obj.url, obj.title);
- if ("nextURL" in obj)
- result.nextURL = obj.nextURL;
if ("downloadStatus" in obj)
result._downloadStatus = obj.downloadStatus;
- if ("lastModified" in obj)
- result.lastModified = obj.lastModified;
if ("lastSuccess" in obj)
result.lastSuccess = parseInt(obj.lastSuccess) || 0;
if ("lastCheck" in obj)
result._lastCheck = parseInt(obj.lastCheck) || 0;
if ("expires" in obj)
result.expires = parseInt(obj.expires) || 0;
if ("softExpiration" in obj)
result.softExpiration = parseInt(obj.softExpiration) || 0;
if ("errors" in obj)
result._errors = parseInt(obj.errors) || 0;
+ if ("version" in obj)
+ result.version = parseInt(obj.version) || 0;
if ("requiredVersion" in obj)
{
let {addonVersion} = require("info");
result.requiredVersion = obj.requiredVersion;
if (Services.vc.compare(result.requiredVersion, addonVersion) > 0)
result.upgradeRequired = true;
}
- if ("alternativeLocations" in obj)
- result.alternativeLocations = obj.alternativeLocations;
if ("homepage" in obj)
result._homepage = obj.homepage;
if ("lastDownload" in obj)
result._lastDownload = parseInt(obj.lastDownload) || 0;
}
catch (e)
{
// Invalid URL - custom filter group
@@ -454,41 +450,29 @@ DownloadableSubscription.prototype =
{
__proto__: RegularSubscription.prototype,
_downloadStatus: null,
_lastCheck: 0,
_errors: 0,
/**
- * Next URL the downloaded should be attempted from (in case of redirects)
- * @type String
- */
- nextURL: null,
-
- /**
* Status of the last download (ID of a string)
* @type String
*/
get downloadStatus() this._downloadStatus,
set downloadStatus(value)
{
let oldValue = this._downloadStatus;
this._downloadStatus = value;
FilterNotifier.triggerListeners("subscription.downloadStatus", this, value, oldValue);
return this._downloadStatus;
},
/**
- * Value of the Last-Modified header returned by the server on last download
- * @type String
- */
- lastModified: null,
-
- /**
* Time of the last successful download (in seconds since the beginning of the
* epoch).
*/
lastSuccess: 0,
/**
* Time when the subscription was considered for an update last time (in seconds
* since the beginning of the epoch). This will be used to increase softExpiration
@@ -531,54 +515,49 @@ DownloadableSubscription.prototype =
let oldValue = this._errors;
this._errors = value;
FilterNotifier.triggerListeners("subscription.errors", this, value, oldValue);
}
return this._errors;
},
/**
+ * Version of the subscription data retrieved on last successful download
+ * @type Number
+ */
+ version: 0,
+
+ /**
* Minimal Adblock Plus version required for this subscription
* @type String
*/
requiredVersion: null,
/**
* Should be true if requiredVersion is higher than current Adblock Plus version
* @type Boolean
*/
upgradeRequired: false,
/**
- * Value of the X-Alternative-Locations header: comma-separated list of URLs
- * with their weighting factors, e.g.: http://foo.example.com/;q=0.5,http://bar.example.com/;q=2
- * @type String
- */
- alternativeLocations: null,
-
- /**
* See Subscription.serialize()
*/
serialize: function(buffer)
{
RegularSubscription.prototype.serialize.call(this, buffer);
- if (this.nextURL)
- buffer.push("nextURL=" + this.nextURL);
if (this.downloadStatus)
buffer.push("downloadStatus=" + this.downloadStatus);
- if (this.lastModified)
- buffer.push("lastModified=" + this.lastModified);
if (this.lastSuccess)
buffer.push("lastSuccess=" + this.lastSuccess);
if (this.lastCheck)
buffer.push("lastCheck=" + this.lastCheck);
if (this.expires)
buffer.push("expires=" + this.expires);
if (this.softExpiration)
buffer.push("softExpiration=" + this.softExpiration);
if (this.errors)
buffer.push("errors=" + this.errors);
+ if (this.version)
+ buffer.push("version=" + this.version);
if (this.requiredVersion)
buffer.push("requiredVersion=" + this.requiredVersion);
- if (this.alternativeLocations)
- buffer.push("alternativeLocations=" + this.alternativeLocations);
}
};
« lib/downloader.js ('K') | « lib/downloader.js ('k') | lib/synchronizer.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld