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

Unified Diff: lib/synchronizer.js

Issue 29800557: Issue 6559 - Use Map object for known subscriptions (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Avoid lookup for disabled subscriptions Created June 6, 2018, 10:57 a.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
@@ -195,21 +195,21 @@
if (downloadable.redirectURL &&
downloadable.redirectURL != downloadable.url)
{
let oldSubscription = Subscription.fromURL(downloadable.url);
subscription.title = oldSubscription.title;
subscription.disabled = oldSubscription.disabled;
subscription.lastCheck = oldSubscription.lastCheck;
- let listed = (oldSubscription.url in FilterStorage.knownSubscriptions);
+ let listed = FilterStorage.knownSubscriptions.has(oldSubscription.url);
if (listed)
FilterStorage.removeSubscription(oldSubscription);
- delete Subscription.knownSubscriptions[oldSubscription.url];
+ Subscription.knownSubscriptions.delete(oldSubscription.url);
if (listed)
FilterStorage.addSubscription(subscription);
}
// The download actually succeeded
subscription.lastSuccess = subscription.lastDownload = Math.round(
Date.now() / MILLIS_IN_SECOND
@@ -330,17 +330,17 @@
request.channel.loadFlags = request.channel.loadFlags |
request.channel.INHIBIT_CACHING |
request.channel.VALIDATE_ALWAYS;
request.addEventListener("load", ev =>
{
if (onShutdown.done)
return;
- if (!(subscription.url in FilterStorage.knownSubscriptions))
+ if (!FilterStorage.knownSubscriptions.has(subscription.url))
return;
let match = /^(\d+)(?:\s+(\S+))?$/.exec(request.responseText);
if (match && match[1] == "301" && // Moved permanently
match[2] && /^https?:\/\//i.test(match[2]))
{
redirectCallback(match[2]);
}
« 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