Left: | ||
Right: |
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 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
452 subscription.filters.length == 0)) | 452 subscription.filters.length == 0)) |
453 { | 453 { |
454 subscriptions.push(subscription); | 454 subscriptions.push(subscription); |
455 } | 455 } |
456 } | 456 } |
457 | 457 |
458 yield "# Adblock Plus preferences"; | 458 yield "# Adblock Plus preferences"; |
459 yield "version=" + formatVersion; | 459 yield "version=" + formatVersion; |
460 | 460 |
461 let saved = new Set(); | 461 let saved = new Set(); |
462 let buf = []; | |
463 | 462 |
464 // Save subscriptions | 463 // Save subscriptions |
465 for (let subscription of subscriptions) | 464 for (let subscription of subscriptions) |
466 { | 465 { |
467 yield ""; | 466 yield* subscription.serialize(); |
468 | 467 |
469 subscription.serialize(buf); | |
470 if (subscription.filters.length) | 468 if (subscription.filters.length) |
471 { | 469 { |
472 buf.push("", "[Subscription filters]"); | 470 yield "[Subscription filters]"; |
Manish Jethani
2018/10/21 21:51:43
We could actually move this line into serializeFil
Jon Sonesen
2018/10/22 19:27:47
Yeah I will move it.
| |
473 subscription.serializeFilters(buf); | 471 yield* subscription.serializeFilters(); |
474 } | 472 } |
475 for (let line of buf) | |
476 yield line; | |
477 buf.splice(0); | |
478 } | 473 } |
479 | 474 |
480 // Save filter data | 475 // Save filter data |
481 for (let subscription of subscriptions) | 476 for (let subscription of subscriptions) |
482 { | 477 { |
483 for (let filter of subscription.filters) | 478 for (let filter of subscription.filters) |
484 { | 479 { |
485 if (!saved.has(filter.text)) | 480 if (!saved.has(filter.text)) |
486 { | 481 { |
487 filter.serialize(buf); | 482 yield* filter.serialize(); |
488 saved.add(filter.text); | 483 saved.add(filter.text); |
489 for (let line of buf) | |
490 yield line; | |
491 buf.splice(0); | |
492 } | 484 } |
493 } | 485 } |
494 } | 486 } |
495 }, | 487 }, |
496 | 488 |
497 /** | 489 /** |
498 * Will be set to true if saveToDisk() is running (reentrance protection). | 490 * Will be set to true if saveToDisk() is running (reentrance protection). |
499 * @type {boolean} | 491 * @type {boolean} |
500 */ | 492 */ |
501 _saving: false, | 493 _saving: false, |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
654 * @param {Subscription} subscription filter subscription to be removed | 646 * @param {Subscription} subscription filter subscription to be removed |
655 */ | 647 */ |
656 function removeSubscriptionFilters(subscription) | 648 function removeSubscriptionFilters(subscription) |
657 { | 649 { |
658 if (!FilterStorage.knownSubscriptions.has(subscription.url)) | 650 if (!FilterStorage.knownSubscriptions.has(subscription.url)) |
659 return; | 651 return; |
660 | 652 |
661 for (let filter of subscription.filters) | 653 for (let filter of subscription.filters) |
662 filter.removeSubscription(subscription); | 654 filter.removeSubscription(subscription); |
663 } | 655 } |
OLD | NEW |