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

Delta Between Two Patch Sets: lib/iniParser.js

Issue 29934588: Issue 7094 - Encapsulate management of subscription filters (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Left Patch Set: Created Nov. 2, 2018, 10:34 p.m.
Right Patch Set: Remove hasFilter and related code Created Nov. 18, 2018, 10:21 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
LEFTRIGHT
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 {
101 this.subscriptions.push(subscription); 100 this.subscriptions.push(subscription);
102 subscription.filterObjects = [];
103 }
104 break; 101 break;
105 102
106 case "subscription filters": 103 case "subscription filters":
107 if (this.subscriptions.length) 104 if (this.subscriptions.length)
108 { 105 {
109 let currentSubscription = this.subscriptions[ 106 let currentSubscription = this.subscriptions[
110 this.subscriptions.length - 1 107 this.subscriptions.length - 1
111 ]; 108 ];
112 for (let text of this._curObj) 109 for (let text of this._curObj)
113 { 110 {
114 let filter = Filter.fromText(text); 111 let filter = Filter.fromText(text);
115 currentSubscription.filters.push(filter.text); 112 currentSubscription.addFilter(filter);
116 currentSubscription.filterObjects.push(filter);
117 filter.addSubscription(currentSubscription); 113 filter.addSubscription(currentSubscription);
118 } 114 }
119 } 115 }
120 break; 116 break;
121 } 117 }
122 } 118 }
123 119
124 if (line === null) 120 if (line === null)
125 return; 121 return;
126 122
(...skipping 21 matching lines...) Expand all
148 } 144 }
149 finally 145 finally
150 { 146 {
151 Filter.knownFilters = origKnownFilters; 147 Filter.knownFilters = origKnownFilters;
152 Subscription.knownSubscriptions = origKnownSubscriptions; 148 Subscription.knownSubscriptions = origKnownSubscriptions;
153 } 149 }
154 } 150 }
155 } 151 }
156 152
157 exports.INIParser = INIParser; 153 exports.INIParser = INIParser;
LEFTRIGHT

Powered by Google App Engine
This is Rietveld