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

Side by Side Diff: lib/synchronizer.js

Issue 29934588: Issue 7094 - Encapsulate management of subscription filters (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Remove hasFilter and related code Created Nov. 18, 2018, 10:21 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
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 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 320
321 let match = /^(\d+)(?:\s+(\S+))?$/.exec(request.responseText); 321 let match = /^(\d+)(?:\s+(\S+))?$/.exec(request.responseText);
322 if (match && match[1] == "301" && // Moved permanently 322 if (match && match[1] == "301" && // Moved permanently
323 match[2] && /^https?:\/\//i.test(match[2])) 323 match[2] && /^https?:\/\//i.test(match[2]))
324 { 324 {
325 redirectCallback(match[2]); 325 redirectCallback(match[2]);
326 } 326 }
327 else if (match && match[1] == "410") // Gone 327 else if (match && match[1] == "410") // Gone
328 { 328 {
329 let data = "[Adblock]\n" + 329 let data = "[Adblock]\n" +
330 subscription.filters.map(f => f.text).join("\n"); 330 [...subscription.filterText()].join("\n");
331 redirectCallback("data:text/plain," + encodeURIComponent(data)); 331 redirectCallback("data:text/plain," + encodeURIComponent(data));
332 } 332 }
333 }, false); 333 }, false);
334 request.send(null); 334 request.send(null);
335 } 335 }
336 } 336 }
337 } 337 }
338 } 338 }
339 339
340 /** 340 /**
341 * This object is responsible for downloading filter subscriptions whenever 341 * This object is responsible for downloading filter subscriptions whenever
342 * necessary. 342 * necessary.
343 * @type {Synchronizer} 343 * @type {Synchronizer}
344 */ 344 */
345 let synchronizer = new Synchronizer(); 345 let synchronizer = new Synchronizer();
346 346
347 exports.Synchronizer = synchronizer; 347 exports.Synchronizer = synchronizer;
OLDNEW

Powered by Google App Engine
This is Rietveld