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 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 return this.saveToDisk(); | 470 return this.saveToDisk(); |
471 }); | 471 }); |
472 } | 472 } |
473 | 473 |
474 /** | 474 /** |
475 * Generator serializing filter data and yielding it line by line. | 475 * Generator serializing filter data and yielding it line by line. |
476 * @yields {string} | 476 * @yields {string} |
477 */ | 477 */ |
478 *exportData() | 478 *exportData() |
479 { | 479 { |
480 // Do not persist external subscriptions | |
481 let subscriptions = []; | |
482 for (let subscription of this.subscriptions()) | |
483 { | |
484 if (!(subscription instanceof ExternalSubscription) && | |
485 !(subscription instanceof SpecialSubscription && | |
486 subscription.filterCount == 0)) | |
487 { | |
488 subscriptions.push(subscription); | |
489 } | |
490 } | |
491 | |
492 yield "# Adblock Plus preferences"; | 480 yield "# Adblock Plus preferences"; |
493 yield "version=" + this.formatVersion; | 481 yield "version=" + this.formatVersion; |
494 | 482 |
495 let saved = new Set(); | 483 let saved = new Set(); |
496 | 484 |
497 // Save subscriptions | 485 // Save subscriptions |
498 for (let subscription of subscriptions) | 486 for (let subscription of this.subscriptions()) |
499 { | 487 { |
500 yield* subscription.serialize(); | 488 // Do not persist external subscriptions |
501 yield* subscription.serializeFilters(); | 489 if (!(subscription instanceof ExternalSubscription) && |
502 } | 490 !(subscription instanceof SpecialSubscription && |
| 491 subscription.filters.length == 0)) |
| 492 { |
| 493 yield* subscription.serialize(); |
| 494 yield* subscription.serializeFilters(); |
| 495 } |
503 | 496 |
504 // Save filter data | 497 // Save filter data |
505 for (let subscription of subscriptions) | 498 for (let subscription of subscriptions) |
506 { | 499 { |
507 for (let filter of subscription.filters()) | 500 for (let filter of subscription.filters()) |
508 { | 501 { |
| 502 // Save filter data |
509 if (!saved.has(filter.text)) | 503 if (!saved.has(filter.text)) |
510 { | 504 { |
511 yield* filter.serialize(); | 505 yield* filter.serialize(); |
512 saved.add(filter.text); | 506 saved.add(filter.text); |
513 } | 507 } |
514 } | 508 } |
515 } | 509 } |
516 } | 510 } |
517 | 511 |
518 /** | 512 /** |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 * subscription is disconnected from its own filters. | 670 * subscription is disconnected from its own filters. |
677 */ | 671 */ |
678 function disconnectSubscriptionFilters(subscription, filters) | 672 function disconnectSubscriptionFilters(subscription, filters) |
679 { | 673 { |
680 if (!filterStorage.knownSubscriptions.has(subscription.url)) | 674 if (!filterStorage.knownSubscriptions.has(subscription.url)) |
681 return; | 675 return; |
682 | 676 |
683 for (let filter of filters || subscription.filters()) | 677 for (let filter of filters || subscription.filters()) |
684 filter.removeSubscription(subscription); | 678 filter.removeSubscription(subscription); |
685 } | 679 } |
OLD | NEW |