Index: lib/downloader.js |
=================================================================== |
--- a/lib/downloader.js |
+++ b/lib/downloader.js |
@@ -191,13 +191,18 @@ |
url += "&"; |
else |
url += "?"; |
+ // We limit the download count to 4+ to keep the request anonymized |
+ let downloadCount = downloadable.downloadCount; |
+ if (downloadable.downloadCount > 4) |
Wladimir Palant
2014/11/11 17:28:16
No need to reference downloadable again here, just
Thomas Greiner
2014/11/11 17:53:18
Sorry, I missed that. Done.
|
+ downloadCount = "4+"; |
url += "addonName=" + encodeURIComponent(addonName) + |
"&addonVersion=" + encodeURIComponent(addonVersion) + |
"&application=" + encodeURIComponent(application) + |
"&applicationVersion=" + encodeURIComponent(applicationVersion) + |
"&platform=" + encodeURIComponent(platform) + |
"&platformVersion=" + encodeURIComponent(platformVersion) + |
- "&lastVersion=" + encodeURIComponent(downloadable.lastVersion); |
+ "&lastVersion=" + encodeURIComponent(downloadable.lastVersion) + |
+ "&downloadCount=" + encodeURIComponent(downloadCount); |
return url; |
}, |
@@ -291,6 +296,8 @@ |
return; |
} |
+ downloadable.downloadCount++; |
+ |
this.onDownloadSuccess(downloadable, request.responseText, errorCallback, function redirectCallback(url) |
{ |
if (redirects >= this.maxRedirects) |
@@ -378,4 +385,10 @@ |
* @type Integer |
*/ |
hardExpiration: 0, |
+ |
+ /** |
+ * Number indicating how often the object was downloaded. |
+ * @type Integer |
+ */ |
+ downloadCount: 0, |
}; |