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

Side by Side Diff: lib/subscriptionClasses.js

Issue 6305806509146112: Issue 427 - Remove non-standard function and getter syntax (Closed)
Patch Set: Created May 5, 2014, 12:18 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/requestNotifier.js ('k') | lib/sync.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 <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2014 Eyeo GmbH 3 * Copyright (C) 2006-2014 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 filters: null, 61 filters: null,
62 62
63 _title: null, 63 _title: null,
64 _fixedTitle: false, 64 _fixedTitle: false,
65 _disabled: false, 65 _disabled: false,
66 66
67 /** 67 /**
68 * Title of the filter subscription 68 * Title of the filter subscription
69 * @type String 69 * @type String
70 */ 70 */
71 get title() this._title, 71 get title() { return this._title; },
72 set title(value) 72 set title(value)
73 { 73 {
74 if (value != this._title) 74 if (value != this._title)
75 { 75 {
76 let oldValue = this._title; 76 let oldValue = this._title;
77 this._title = value; 77 this._title = value;
78 FilterNotifier.triggerListeners("subscription.title", this, value, oldValu e); 78 FilterNotifier.triggerListeners("subscription.title", this, value, oldValu e);
79 } 79 }
80 return this._title; 80 return this._title;
81 }, 81 },
82 82
83 /** 83 /**
84 * Determines whether the title should be editable 84 * Determines whether the title should be editable
85 * @type Boolean 85 * @type Boolean
86 */ 86 */
87 get fixedTitle() this._fixedTitle, 87 get fixedTitle() { return this._fixedTitle; },
88 set fixedTitle(value) 88 set fixedTitle(value)
89 { 89 {
90 if (value != this._fixedTitle) 90 if (value != this._fixedTitle)
91 { 91 {
92 let oldValue = this._fixedTitle; 92 let oldValue = this._fixedTitle;
93 this._fixedTitle = value; 93 this._fixedTitle = value;
94 FilterNotifier.triggerListeners("subscription.fixedTitle", this, value, ol dValue); 94 FilterNotifier.triggerListeners("subscription.fixedTitle", this, value, ol dValue);
95 } 95 }
96 return this._fixedTitle; 96 return this._fixedTitle;
97 }, 97 },
98 98
99 /** 99 /**
100 * Defines whether the filters in the subscription should be disabled 100 * Defines whether the filters in the subscription should be disabled
101 * @type Boolean 101 * @type Boolean
102 */ 102 */
103 get disabled() this._disabled, 103 get disabled() { return this._disabled; },
104 set disabled(value) 104 set disabled(value)
105 { 105 {
106 if (value != this._disabled) 106 if (value != this._disabled)
107 { 107 {
108 let oldValue = this._disabled; 108 let oldValue = this._disabled;
109 this._disabled = value; 109 this._disabled = value;
110 FilterNotifier.triggerListeners("subscription.disabled", this, value, oldV alue); 110 FilterNotifier.triggerListeners("subscription.disabled", this, value, oldV alue);
111 } 111 }
112 return this._disabled; 112 return this._disabled;
113 }, 113 },
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 return false; 286 return false;
287 }, 287 },
288 288
289 /** 289 /**
290 * See Subscription.serialize() 290 * See Subscription.serialize()
291 */ 291 */
292 serialize: function(buffer) 292 serialize: function(buffer)
293 { 293 {
294 Subscription.prototype.serialize.call(this, buffer); 294 Subscription.prototype.serialize.call(this, buffer);
295 if (this.defaults && this.defaults.length) 295 if (this.defaults && this.defaults.length)
296 buffer.push("defaults=" + this.defaults.filter(function(type) type in Spec ialSubscription.defaultsMap).join(" ")); 296 buffer.push("defaults=" + this.defaults.filter(function(type) {
297 return (type in SpecialSubscription.defaultsMap);
298 }).join(" "));
297 if (this._lastDownload) 299 if (this._lastDownload)
298 buffer.push("lastDownload=" + this._lastDownload); 300 buffer.push("lastDownload=" + this._lastDownload);
299 } 301 }
300 }; 302 };
301 303
302 SpecialSubscription.defaultsMap = { 304 SpecialSubscription.defaultsMap = {
303 __proto__: null, 305 __proto__: null,
304 "whitelist": WhitelistFilter, 306 "whitelist": WhitelistFilter,
305 "blocking": BlockingFilter, 307 "blocking": BlockingFilter,
306 "elemhide": ElemHideBase 308 "elemhide": ElemHideBase
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 { 361 {
360 __proto__: Subscription.prototype, 362 __proto__: Subscription.prototype,
361 363
362 _homepage: null, 364 _homepage: null,
363 _lastDownload: 0, 365 _lastDownload: 0,
364 366
365 /** 367 /**
366 * Filter subscription homepage if known 368 * Filter subscription homepage if known
367 * @type String 369 * @type String
368 */ 370 */
369 get homepage() this._homepage, 371 get homepage() { return this._homepage; },
370 set homepage(value) 372 set homepage(value)
371 { 373 {
372 if (value != this._homepage) 374 if (value != this._homepage)
373 { 375 {
374 let oldValue = this._homepage; 376 let oldValue = this._homepage;
375 this._homepage = value; 377 this._homepage = value;
376 FilterNotifier.triggerListeners("subscription.homepage", this, value, oldV alue); 378 FilterNotifier.triggerListeners("subscription.homepage", this, value, oldV alue);
377 } 379 }
378 return this._homepage; 380 return this._homepage;
379 }, 381 },
380 382
381 /** 383 /**
382 * Time of the last subscription download (in seconds since the beginning of t he epoch) 384 * Time of the last subscription download (in seconds since the beginning of t he epoch)
383 * @type Number 385 * @type Number
384 */ 386 */
385 get lastDownload() this._lastDownload, 387 get lastDownload() { return this._lastDownload; },
386 set lastDownload(value) 388 set lastDownload(value)
387 { 389 {
388 if (value != this._lastDownload) 390 if (value != this._lastDownload)
389 { 391 {
390 let oldValue = this._lastDownload; 392 let oldValue = this._lastDownload;
391 this._lastDownload = value; 393 this._lastDownload = value;
392 FilterNotifier.triggerListeners("subscription.lastDownload", this, value, oldValue); 394 FilterNotifier.triggerListeners("subscription.lastDownload", this, value, oldValue);
393 } 395 }
394 return this._lastDownload; 396 return this._lastDownload;
395 }, 397 },
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 __proto__: RegularSubscription.prototype, 453 __proto__: RegularSubscription.prototype,
452 454
453 _downloadStatus: null, 455 _downloadStatus: null,
454 _lastCheck: 0, 456 _lastCheck: 0,
455 _errors: 0, 457 _errors: 0,
456 458
457 /** 459 /**
458 * Status of the last download (ID of a string) 460 * Status of the last download (ID of a string)
459 * @type String 461 * @type String
460 */ 462 */
461 get downloadStatus() this._downloadStatus, 463 get downloadStatus() { return this._downloadStatus; },
462 set downloadStatus(value) 464 set downloadStatus(value)
463 { 465 {
464 let oldValue = this._downloadStatus; 466 let oldValue = this._downloadStatus;
465 this._downloadStatus = value; 467 this._downloadStatus = value;
466 FilterNotifier.triggerListeners("subscription.downloadStatus", this, value, oldValue); 468 FilterNotifier.triggerListeners("subscription.downloadStatus", this, value, oldValue);
467 return this._downloadStatus; 469 return this._downloadStatus;
468 }, 470 },
469 471
470 /** 472 /**
471 * Time of the last successful download (in seconds since the beginning of the 473 * Time of the last successful download (in seconds since the beginning of the
472 * epoch). 474 * epoch).
473 */ 475 */
474 lastSuccess: 0, 476 lastSuccess: 0,
475 477
476 /** 478 /**
477 * Time when the subscription was considered for an update last time (in secon ds 479 * Time when the subscription was considered for an update last time (in secon ds
478 * since the beginning of the epoch). This will be used to increase softExpira tion 480 * since the beginning of the epoch). This will be used to increase softExpira tion
479 * if the user doesn't use Adblock Plus for some time. 481 * if the user doesn't use Adblock Plus for some time.
480 * @type Number 482 * @type Number
481 */ 483 */
482 get lastCheck() this._lastCheck, 484 get lastCheck() { return this._lastCheck; },
483 set lastCheck(value) 485 set lastCheck(value)
484 { 486 {
485 if (value != this._lastCheck) 487 if (value != this._lastCheck)
486 { 488 {
487 let oldValue = this._lastCheck; 489 let oldValue = this._lastCheck;
488 this._lastCheck = value; 490 this._lastCheck = value;
489 FilterNotifier.triggerListeners("subscription.lastCheck", this, value, old Value); 491 FilterNotifier.triggerListeners("subscription.lastCheck", this, value, old Value);
490 } 492 }
491 return this._lastCheck; 493 return this._lastCheck;
492 }, 494 },
493 495
494 /** 496 /**
495 * Hard expiration time of the filter subscription (in seconds since the begin ning of the epoch) 497 * Hard expiration time of the filter subscription (in seconds since the begin ning of the epoch)
496 * @type Number 498 * @type Number
497 */ 499 */
498 expires: 0, 500 expires: 0,
499 501
500 /** 502 /**
501 * Soft expiration time of the filter subscription (in seconds since the begin ning of the epoch) 503 * Soft expiration time of the filter subscription (in seconds since the begin ning of the epoch)
502 * @type Number 504 * @type Number
503 */ 505 */
504 softExpiration: 0, 506 softExpiration: 0,
505 507
506 /** 508 /**
507 * Number of download failures since last success 509 * Number of download failures since last success
508 * @type Number 510 * @type Number
509 */ 511 */
510 get errors() this._errors, 512 get errors() { return this._errors; },
511 set errors(value) 513 set errors(value)
512 { 514 {
513 if (value != this._errors) 515 if (value != this._errors)
514 { 516 {
515 let oldValue = this._errors; 517 let oldValue = this._errors;
516 this._errors = value; 518 this._errors = value;
517 FilterNotifier.triggerListeners("subscription.errors", this, value, oldVal ue); 519 FilterNotifier.triggerListeners("subscription.errors", this, value, oldVal ue);
518 } 520 }
519 return this._errors; 521 return this._errors;
520 }, 522 },
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 if (this.softExpiration) 556 if (this.softExpiration)
555 buffer.push("softExpiration=" + this.softExpiration); 557 buffer.push("softExpiration=" + this.softExpiration);
556 if (this.errors) 558 if (this.errors)
557 buffer.push("errors=" + this.errors); 559 buffer.push("errors=" + this.errors);
558 if (this.version) 560 if (this.version)
559 buffer.push("version=" + this.version); 561 buffer.push("version=" + this.version);
560 if (this.requiredVersion) 562 if (this.requiredVersion)
561 buffer.push("requiredVersion=" + this.requiredVersion); 563 buffer.push("requiredVersion=" + this.requiredVersion);
562 } 564 }
563 }; 565 };
OLDNEW
« no previous file with comments | « lib/requestNotifier.js ('k') | lib/sync.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld