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

Unified Diff: lib/synchronizer.js

Issue 29807560: Issue 6745 - Prefer strict equality operator (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created June 14, 2018, 4:11 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
« no previous file with comments | « lib/subscriptionClasses.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/synchronizer.js
===================================================================
--- a/lib/synchronizer.js
+++ b/lib/synchronizer.js
@@ -109,17 +109,17 @@
* Creates a Downloadable instance for a subscription.
* @param {Subscription} subscription
* @param {boolean} manual
* @return {Downloadable}
*/
_getDownloadable(subscription, manual)
{
let result = new Downloadable(subscription.url);
- if (subscription.lastDownload != subscription.lastSuccess)
+ if (subscription.lastDownload !== subscription.lastSuccess)
result.lastError = subscription.lastDownload * MILLIS_IN_SECOND;
result.lastCheck = subscription.lastCheck * MILLIS_IN_SECOND;
result.lastVersion = subscription.version;
result.softExpiration = subscription.softExpiration * MILLIS_IN_SECOND;
result.hardExpiration = subscription.expires * MILLIS_IN_SECOND;
result.manual = manual;
result.downloadCount = subscription.downloadCount;
return result;
@@ -171,34 +171,34 @@
{
let keyword = match[1].toLowerCase();
let value = match[2];
if (keyword in params)
{
params[keyword] = value;
remove.push(i);
}
- else if (keyword == "checksum")
+ else if (keyword === "checksum")
{
lines.splice(i--, 1);
let checksum = Utils.generateChecksum(lines);
- if (checksum && checksum != value.replace(/=+$/, ""))
+ if (checksum && checksum !== value.replace(/=+$/, ""))
return errorCallback("synchronize_checksum_mismatch");
}
}
}
if (params.redirect)
return redirectCallback(params.redirect);
// Handle redirects
let subscription = Subscription.fromURL(downloadable.redirectURL ||
downloadable.url);
if (downloadable.redirectURL &&
- downloadable.redirectURL != downloadable.url)
+ downloadable.redirectURL !== downloadable.url)
{
let oldSubscription = Subscription.fromURL(downloadable.url);
subscription.title = oldSubscription.title;
subscription.disabled = oldSubscription.disabled;
subscription.lastCheck = oldSubscription.lastCheck;
let listed = FilterStorage.knownSubscriptions.has(oldSubscription.url);
if (listed)
@@ -230,17 +230,17 @@
{
url = new URL(params.homepage);
}
catch (e)
{
url = null;
}
- if (url && (url.protocol == "http:" || url.protocol == "https:"))
+ if (url && (url.protocol === "http:" || url.protocol === "https:"))
subscription.homepage = url.href;
}
if (params.title)
{
subscription.title = params.title;
subscription.fixedTitle = true;
}
@@ -332,22 +332,22 @@
{
if (onShutdown.done)
return;
if (!FilterStorage.knownSubscriptions.has(subscription.url))
return;
let match = /^(\d+)(?:\s+(\S+))?$/.exec(request.responseText);
- if (match && match[1] == "301" && // Moved permanently
+ if (match && match[1] === "301" && // Moved permanently
match[2] && /^https?:\/\//i.test(match[2]))
{
redirectCallback(match[2]);
}
- else if (match && match[1] == "410") // Gone
+ else if (match && match[1] === "410") // Gone
{
let data = "[Adblock]\n" +
subscription.filters.map(f => f.text).join("\n");
redirectCallback("data:text/plain," + encodeURIComponent(data));
}
}, false);
request.send(null);
}
« no previous file with comments | « lib/subscriptionClasses.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld