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

Delta Between Two Patch Sets: lib/downloader.js

Issue 29801558: Issue 6737 - Use String.includes instead of String.indexOf (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Left Patch Set: Created June 7, 2018, 9:27 a.m.
Right Patch Set: Replace more instances Created June 7, 2018, 9:51 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « lib/common.js ('k') | lib/filterClasses.js » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH 3 * Copyright (C) 2006-present 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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 * Generates the real download URL for an object by appending various 200 * Generates the real download URL for an object by appending various
201 * parameters. 201 * parameters.
202 * @param {Downloadable} downloadable 202 * @param {Downloadable} downloadable
203 * @return {string} 203 * @return {string}
204 */ 204 */
205 getDownloadUrl(downloadable) 205 getDownloadUrl(downloadable)
206 { 206 {
207 const {addonName, addonVersion, application, applicationVersion, 207 const {addonName, addonVersion, application, applicationVersion,
208 platform, platformVersion} = require("info"); 208 platform, platformVersion} = require("info");
209 let url = downloadable.redirectURL || downloadable.url; 209 let url = downloadable.redirectURL || downloadable.url;
210 if (url.indexOf("?") >= 0) 210 if (url.includes("?"))
211 url += "&"; 211 url += "&";
212 else 212 else
213 url += "?"; 213 url += "?";
214 // We limit the download count to 4+ to keep the request anonymized 214 // We limit the download count to 4+ to keep the request anonymized
215 let {downloadCount} = downloadable; 215 let {downloadCount} = downloadable;
216 if (downloadCount > 4) 216 if (downloadCount > 4)
217 downloadCount = "4+"; 217 downloadCount = "4+";
218 url += "addonName=" + encodeURIComponent(addonName) + 218 url += "addonName=" + encodeURIComponent(addonName) +
219 "&addonVersion=" + encodeURIComponent(addonVersion) + 219 "&addonVersion=" + encodeURIComponent(addonVersion) +
220 "&application=" + encodeURIComponent(application) + 220 "&application=" + encodeURIComponent(application) +
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 * @type {number} 413 * @type {number}
414 */ 414 */
415 hardExpiration: 0, 415 hardExpiration: 0,
416 416
417 /** 417 /**
418 * Number indicating how often the object was downloaded. 418 * Number indicating how often the object was downloaded.
419 * @type {number} 419 * @type {number}
420 */ 420 */
421 downloadCount: 0 421 downloadCount: 0
422 }; 422 };
LEFTRIGHT

Powered by Google App Engine
This is Rietveld