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 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 return this.saveToDisk(); | 463 return this.saveToDisk(); |
464 }); | 464 }); |
465 } | 465 } |
466 | 466 |
467 /** | 467 /** |
468 * Generator serializing filter data and yielding it line by line. | 468 * Generator serializing filter data and yielding it line by line. |
469 * @yields {string} | 469 * @yields {string} |
470 */ | 470 */ |
471 *exportData() | 471 *exportData() |
472 { | 472 { |
473 // Do not persist external subscriptions | |
474 let subscriptions = []; | |
475 for (let subscription of this.subscriptions()) | |
476 { | |
477 if (!(subscription instanceof ExternalSubscription) && | |
478 !(subscription instanceof SpecialSubscription && | |
479 subscription.filters.length == 0)) | |
480 { | |
481 subscriptions.push(subscription); | |
482 } | |
483 } | |
484 | |
485 yield "# Adblock Plus preferences"; | 473 yield "# Adblock Plus preferences"; |
486 yield "version=" + this.formatVersion; | 474 yield "version=" + this.formatVersion; |
487 | 475 |
488 let saved = new Set(); | 476 let saved = new Set(); |
489 | 477 |
490 // Save subscriptions | 478 // Save subscriptions |
491 for (let subscription of subscriptions) | 479 for (let subscription of this.subscriptions()) |
492 { | 480 { |
493 yield* subscription.serialize(); | 481 // Do not persist external subscriptions |
494 yield* subscription.serializeFilters(); | 482 if (!(subscription instanceof ExternalSubscription) && |
495 } | 483 !(subscription instanceof SpecialSubscription && |
| 484 subscription.filters.length == 0)) |
| 485 { |
| 486 yield* subscription.serialize(); |
| 487 yield* subscription.serializeFilters(); |
| 488 } |
496 | 489 |
497 // Save filter data | |
498 for (let subscription of subscriptions) | |
499 { | |
500 for (let filter of subscription.filters) | 490 for (let filter of subscription.filters) |
501 { | 491 { |
| 492 // Save filter data |
502 if (!saved.has(filter.text)) | 493 if (!saved.has(filter.text)) |
503 { | 494 { |
504 yield* filter.serialize(); | 495 yield* filter.serialize(); |
505 saved.add(filter.text); | 496 saved.add(filter.text); |
506 } | 497 } |
507 } | 498 } |
508 } | 499 } |
509 } | 500 } |
510 | 501 |
511 /** | 502 /** |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
663 * disconnected from its filters. | 654 * disconnected from its filters. |
664 */ | 655 */ |
665 function disconnectSubscriptionFilters(subscription) | 656 function disconnectSubscriptionFilters(subscription) |
666 { | 657 { |
667 if (!filterStorage.knownSubscriptions.has(subscription.url)) | 658 if (!filterStorage.knownSubscriptions.has(subscription.url)) |
668 return; | 659 return; |
669 | 660 |
670 for (let filter of subscription.filters) | 661 for (let filter of subscription.filters) |
671 filter.removeSubscription(subscription); | 662 filter.removeSubscription(subscription); |
672 } | 663 } |
OLD | NEW |