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

Delta Between Two Patch Sets: lib/synchronizer.js

Issue 29800557: Issue 6559 - Use Map object for known subscriptions (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Left Patch Set: Avoid lookup for disabled subscriptions Created June 6, 2018, 10:57 a.m.
Right Patch Set: Move check for known subscription into removeSubscription Created June 6, 2018, 11 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« lib/filterStorage.js ('K') | « lib/subscriptionClasses.js ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 downloadable.url); 194 downloadable.url);
195 if (downloadable.redirectURL && 195 if (downloadable.redirectURL &&
196 downloadable.redirectURL != downloadable.url) 196 downloadable.redirectURL != downloadable.url)
197 { 197 {
198 let oldSubscription = Subscription.fromURL(downloadable.url); 198 let oldSubscription = Subscription.fromURL(downloadable.url);
199 subscription.title = oldSubscription.title; 199 subscription.title = oldSubscription.title;
200 subscription.disabled = oldSubscription.disabled; 200 subscription.disabled = oldSubscription.disabled;
201 subscription.lastCheck = oldSubscription.lastCheck; 201 subscription.lastCheck = oldSubscription.lastCheck;
202 202
203 let listed = FilterStorage.knownSubscriptions.has(oldSubscription.url); 203 let listed = FilterStorage.knownSubscriptions.has(oldSubscription.url);
204 if (listed) 204 FilterStorage.removeSubscription(oldSubscription);
205 FilterStorage.removeSubscription(oldSubscription);
206 205
207 Subscription.knownSubscriptions.delete(oldSubscription.url); 206 Subscription.knownSubscriptions.delete(oldSubscription.url);
208 207
209 if (listed) 208 if (listed)
210 FilterStorage.addSubscription(subscription); 209 FilterStorage.addSubscription(subscription);
211 } 210 }
212 211
213 // The download actually succeeded 212 // The download actually succeeded
214 subscription.lastSuccess = subscription.lastDownload = Math.round( 213 subscription.lastSuccess = subscription.lastDownload = Math.round(
215 Date.now() / MILLIS_IN_SECOND 214 Date.now() / MILLIS_IN_SECOND
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 subscription.filters.map(f => f.text).join("\n"); 349 subscription.filters.map(f => f.text).join("\n");
351 redirectCallback("data:text/plain," + encodeURIComponent(data)); 350 redirectCallback("data:text/plain," + encodeURIComponent(data));
352 } 351 }
353 }, false); 352 }, false);
354 request.send(null); 353 request.send(null);
355 } 354 }
356 } 355 }
357 } 356 }
358 }; 357 };
359 Synchronizer.init(); 358 Synchronizer.init();
LEFTRIGHT

Powered by Google App Engine
This is Rietveld