Index: lib/filterStorage.js |
=================================================================== |
--- a/lib/filterStorage.js |
+++ b/lib/filterStorage.js |
@@ -438,53 +438,48 @@ |
}); |
}, |
/** |
* Generator serializing filter data and yielding it line by line. |
*/ |
*exportData() |
{ |
- // Do not persist external subscriptions |
- let subscriptions = []; |
- for (let subscription of this.subscriptions()) |
- { |
- if (!(subscription instanceof ExternalSubscription) && |
- !(subscription instanceof SpecialSubscription && |
- subscription.filters.length == 0)) |
- { |
- subscriptions.push(subscription); |
- } |
- } |
- |
yield "# Adblock Plus preferences"; |
yield "version=" + formatVersion; |
let saved = new Set(); |
let buf = []; |
// Save subscriptions |
- for (let subscription of subscriptions) |
+ for (let subscription of this.subscriptions()) |
{ |
+ // Do not persist external subscriptions, special subscriptions |
+ // and subscriptions with no filters. |
+ if (subscription instanceof ExternalSubscription || |
+ subscription instanceof SpecialSubscription && |
+ subscription.filters.length == 0) |
+ { |
+ continue; |
+ } |
+ |
yield ""; |
+ subscription.serialize(buf); |
- subscription.serialize(buf); |
if (subscription.filters.length) |
{ |
buf.push("", "[Subscription filters]"); |
subscription.serializeFilters(buf); |
} |
+ |
for (let line of buf) |
yield line; |
buf.splice(0); |
- } |
- // Save filter data |
- for (let subscription of subscriptions) |
- { |
+ // Save filter data |
for (let filter of subscription.filters) |
{ |
if (!saved.has(filter.text)) |
{ |
filter.serialize(buf); |
saved.add(filter.text); |
for (let line of buf) |
yield line; |