OLD | NEW |
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 Loading... |
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.filters.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; |
OLD | NEW |