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

Delta Between Two Patch Sets: lib/subscriptionClasses.js

Issue 29900557: Issue 7016 - Convert serialization functions into generators (Closed)
Left Patch Set: Address Nits Created Oct. 23, 2018, 3:10 a.m.
Right Patch Set: Actually address nits Created Oct. 23, 2018, 3:21 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
« no previous file with change/comment | « lib/filterStorage.js ('k') | test/filterClasses.js » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 */ 260 */
261 defaults: null, 261 defaults: null,
262 262
263 /** 263 /**
264 * Tests whether a filter should be added to this group by default 264 * Tests whether a filter should be added to this group by default
265 * @param {Filter} filter filter to be tested 265 * @param {Filter} filter filter to be tested
266 * @return {boolean} 266 * @return {boolean}
267 */ 267 */
268 isDefaultFor(filter) 268 isDefaultFor(filter)
269 { 269 {
270 if (this.defaults) 270 if (this.defaults && this.defaults.length)
271 { 271 {
272 for (let type of this.defaults) 272 for (let type of this.defaults)
273 { 273 {
274 if (filter instanceof SpecialSubscription.defaultsMap.get(type)) 274 if (filter instanceof SpecialSubscription.defaultsMap.get(type))
275 return true; 275 return true;
276 if (!(filter instanceof ActiveFilter) && type == "blacklist") 276 if (!(filter instanceof ActiveFilter) && type == "blacklist")
277 return true; 277 return true;
278 } 278 }
279 } 279 }
280 280
281 return false; 281 return false;
282 }, 282 },
283 283
284 /** 284 /**
285 * See Subscription.serialize() 285 * See Subscription.serialize()
286 * @inheritdoc 286 * @inheritdoc
287 */ 287 */
288 *serialize() 288 *serialize()
289 { 289 {
290 let {defaults, _lastDownload} = this; 290 let {defaults, _lastDownload} = this;
291 291
292 yield* Subscription.prototype.serialize.call(this); 292 yield* Subscription.prototype.serialize.call(this);
293 293
294 if (defaults && defaults.length) 294 if (defaults)
295 { 295 {
296 yield "defaults=" + 296 yield "defaults=" +
297 defaults.filter( 297 defaults.filter(
298 type => SpecialSubscription.defaultsMap.has(type) 298 type => SpecialSubscription.defaultsMap.has(type)
299 ).join(" "); 299 ).join(" ");
300 } 300 }
301 if (_lastDownload) 301 if (_lastDownload)
302 yield "lastDownload=" + _lastDownload; 302 yield "lastDownload=" + _lastDownload;
303 } 303 }
304 }); 304 });
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 if (errors) 582 if (errors)
583 yield "errors=" + errors; 583 yield "errors=" + errors;
584 if (version) 584 if (version)
585 yield "version=" + version; 585 yield "version=" + version;
586 if (requiredVersion) 586 if (requiredVersion)
587 yield "requiredVersion=" + requiredVersion; 587 yield "requiredVersion=" + requiredVersion;
588 if (downloadCount) 588 if (downloadCount)
589 yield "downloadCount=" + downloadCount; 589 yield "downloadCount=" + downloadCount;
590 } 590 }
591 }); 591 });
LEFTRIGHT

Powered by Google App Engine
This is Rietveld