Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: lib/iniParser.js

Issue 29934588: Issue 7094 - Encapsulate management of subscription filters (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created Nov. 2, 2018, 10:34 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/filterStorage.js ('k') | lib/subscriptionClasses.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 switch (this._curSection) 90 switch (this._curSection)
91 { 91 {
92 case "filter": 92 case "filter":
93 if ("text" in this._curObj) 93 if ("text" in this._curObj)
94 Filter.fromObject(this._curObj); 94 Filter.fromObject(this._curObj);
95 break; 95 break;
96 96
97 case "subscription": 97 case "subscription":
98 let subscription = Subscription.fromObject(this._curObj); 98 let subscription = Subscription.fromObject(this._curObj);
99 if (subscription) 99 if (subscription)
100 {
100 this.subscriptions.push(subscription); 101 this.subscriptions.push(subscription);
102 subscription.filterObjects = [];
103 }
101 break; 104 break;
102 105
103 case "subscription filters": 106 case "subscription filters":
104 if (this.subscriptions.length) 107 if (this.subscriptions.length)
105 { 108 {
106 let currentSubscription = this.subscriptions[ 109 let currentSubscription = this.subscriptions[
107 this.subscriptions.length - 1 110 this.subscriptions.length - 1
108 ]; 111 ];
109 for (let text of this._curObj) 112 for (let text of this._curObj)
110 { 113 {
111 let filter = Filter.fromText(text); 114 let filter = Filter.fromText(text);
112 currentSubscription.filters.push(filter); 115 currentSubscription.filters.push(filter.text);
116 currentSubscription.filterObjects.push(filter);
113 filter.addSubscription(currentSubscription); 117 filter.addSubscription(currentSubscription);
114 } 118 }
115 } 119 }
116 break; 120 break;
117 } 121 }
118 } 122 }
119 123
120 if (line === null) 124 if (line === null)
121 return; 125 return;
122 126
(...skipping 21 matching lines...) Expand all
144 } 148 }
145 finally 149 finally
146 { 150 {
147 Filter.knownFilters = origKnownFilters; 151 Filter.knownFilters = origKnownFilters;
148 Subscription.knownSubscriptions = origKnownSubscriptions; 152 Subscription.knownSubscriptions = origKnownSubscriptions;
149 } 153 }
150 } 154 }
151 } 155 }
152 156
153 exports.INIParser = INIParser; 157 exports.INIParser = INIParser;
OLDNEW
« no previous file with comments | « lib/filterStorage.js ('k') | lib/subscriptionClasses.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld