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

Delta Between Two Patch Sets: lib/subscriptionClasses.js

Issue 29945631: Issue 7097 - Make element hiding filter objects ephemeral Base URL: https://hg.adblockplus.org/adblockpluscore/
Left Patch Set: Created Nov. 18, 2018, 3:22 a.m.
Right Patch Set: Simplify Created Nov. 18, 2018, 6:12 a.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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 yield* this._filterText; 162 yield* this._filterText;
163 }, 163 },
164 164
165 /** 165 /**
166 * Yields the {@link Filter} object for each filter in the subscription. 166 * Yields the {@link Filter} object for each filter in the subscription.
167 * @yields {Filter} 167 * @yields {Filter}
168 */ 168 */
169 *filters() 169 *filters()
170 { 170 {
171 for (let i = 0; i < this._filters.length; i++) 171 for (let i = 0; i < this._filters.length; i++)
172 yield this._filters[i] || Filter.fromText(this._filterText[i]); 172 yield this._filters[i] || Filter.fromText(this._filterText[i], false);
173 }, 173 },
174 174
175 /** 175 /**
176 * Returns the {@link Filter} object at the given 0-based index. 176 * Returns the {@link Filter} object at the given 0-based index.
177 * @param {number} index 177 * @param {number} index
178 * @returns {?Filter} 178 * @returns {?Filter}
179 */ 179 */
180 filterAt(index) 180 filterAt(index)
181 { 181 {
182 return this._filters[index] || 182 return this._filters[index] ||
183 (index >= 0 && index < this._filters.length ? 183 (index >= 0 && index < this._filters.length ?
184 Filter.fromText(this._filterText[index]) : null); 184 Filter.fromText(this._filterText[index], false) : null);
185 }, 185 },
186 186
187 /** 187 /**
188 * Returns the 0-based index of the given filter. 188 * Returns the 0-based index of the given filter.
189 * @param {Filter} filter 189 * @param {Filter} filter
190 * @param {number} [fromIndex] The index from which to start the search. 190 * @param {number} [fromIndex] The index from which to start the search.
191 * @return {number} 191 * @return {number}
192 */ 192 */
193 searchFilter(filter, fromIndex = 0) 193 searchFilter(filter, fromIndex = 0)
194 { 194 {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 }, 262 },
263 263
264 /** 264 /**
265 * Clears any in-memory caches held by the object. 265 * Clears any in-memory caches held by the object.
266 * @package 266 * @package
267 */ 267 */
268 clearCaches() 268 clearCaches()
269 { 269 {
270 for (let i = 0; i < this._filters.length; i++) 270 for (let i = 0; i < this._filters.length; i++)
271 { 271 {
272 if (this._filters[i] && this._filters[i].ephemeral) 272 if (this._filters[i] && this._filters[i].ephemeral)
Manish Jethani 2018/11/18 03:29:12 filterClasses.js doesn't keep any references to ep
273 this._filters[i] = null; 273 this._filters[i] = null;
274 } 274 }
275 275
276 this._filterTextLookup = null; 276 this._filterTextLookup = null;
277 }, 277 },
278 278
279 /** 279 /**
280 * Serializes the subscription for writing out on disk. 280 * Serializes the subscription for writing out on disk.
281 * @yields {string} 281 * @yields {string}
282 */ 282 */
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
734 if (errors) 734 if (errors)
735 yield "errors=" + errors; 735 yield "errors=" + errors;
736 if (version) 736 if (version)
737 yield "version=" + version; 737 yield "version=" + version;
738 if (requiredVersion) 738 if (requiredVersion)
739 yield "requiredVersion=" + requiredVersion; 739 yield "requiredVersion=" + requiredVersion;
740 if (downloadCount) 740 if (downloadCount)
741 yield "downloadCount=" + downloadCount; 741 yield "downloadCount=" + downloadCount;
742 } 742 }
743 }); 743 });
LEFTRIGHT

Powered by Google App Engine
This is Rietveld