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: Move check for known subscription into removeSubscription Created June 6, 2018, 11 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
« lib/subscriptionClasses.js ('K') | « 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,20 @@
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);
- if (listed)
kzar 2018/06/07 13:52:26 But we already have `listed` here, but now we don'
Manish Jethani 2018/06/07 14:29:46 Yeah I have to admit the last change is not exactl
- FilterStorage.removeSubscription(oldSubscription);
+ let listed = FilterStorage.knownSubscriptions.has(oldSubscription.url);
+ 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 +329,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]);
}
« lib/subscriptionClasses.js ('K') | « lib/subscriptionClasses.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld