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

Side by Side Diff: lib/subscriptionClasses.js

Issue 6302563414573056: Noissue - Added missing semicolons and other trivial fixes. (Closed)
Patch Set: Created March 6, 2015, 9:42 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/filterClasses.js ('k') | no next file » | 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-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 if (value != this._disabled) 115 if (value != this._disabled)
116 { 116 {
117 let oldValue = this._disabled; 117 let oldValue = this._disabled;
118 this._disabled = value; 118 this._disabled = value;
119 FilterNotifier.triggerListeners("subscription.disabled", this, value, oldV alue); 119 FilterNotifier.triggerListeners("subscription.disabled", this, value, oldV alue);
120 } 120 }
121 return this._disabled; 121 return this._disabled;
122 }, 122 },
123 123
124 /** 124 /**
125 * Serializes the filter to an array of strings for writing out on the disk. 125 * Serializes the subscription to an array of strings for writing out on the d isk.
126 * @param {Array of String} buffer buffer to push the serialization results i nto 126 * @param {Array of String} buffer buffer to push the serialization results i nto
127 */ 127 */
128 serialize: function(buffer) 128 serialize: function(buffer)
129 { 129 {
130 buffer.push("[Subscription]"); 130 buffer.push("[Subscription]");
131 buffer.push("url=" + this.url); 131 buffer.push("url=" + this.url);
132 buffer.push("title=" + this._title); 132 buffer.push("title=" + this._title);
133 if (this._fixedTitle) 133 if (this._fixedTitle)
134 buffer.push("fixedTitle=true"); 134 buffer.push("fixedTitle=true");
135 if (this._disabled) 135 if (this._disabled)
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 try 169 try
170 { 170 {
171 // Test URL for validity 171 // Test URL for validity
172 url = Services.io.newURI(url, null, null).spec; 172 url = Services.io.newURI(url, null, null).spec;
173 return new DownloadableSubscription(url, null); 173 return new DownloadableSubscription(url, null);
174 } 174 }
175 catch (e) 175 catch (e)
176 { 176 {
177 return new SpecialSubscription(url); 177 return new SpecialSubscription(url);
178 } 178 }
179 } 179 };
180 180
181 /** 181 /**
182 * Deserializes a subscription 182 * Deserializes a subscription
183 * 183 *
184 * @param {Object} obj map of serialized properties and their values 184 * @param {Object} obj map of serialized properties and their values
185 * @return {Subscription} subscription or null if the subscription couldn't be c reated 185 * @return {Subscription} subscription or null if the subscription couldn't be c reated
186 */ 186 */
187 Subscription.fromObject = function(obj) 187 Subscription.fromObject = function(obj)
188 { 188 {
189 let result; 189 let result;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 result = new SpecialSubscription(obj.url, obj.title); 243 result = new SpecialSubscription(obj.url, obj.title);
244 if ("defaults" in obj) 244 if ("defaults" in obj)
245 result.defaults = obj.defaults.split(" "); 245 result.defaults = obj.defaults.split(" ");
246 } 246 }
247 if ("fixedTitle" in obj) 247 if ("fixedTitle" in obj)
248 result._fixedTitle = (obj.fixedTitle == "true"); 248 result._fixedTitle = (obj.fixedTitle == "true");
249 if ("disabled" in obj) 249 if ("disabled" in obj)
250 result._disabled = (obj.disabled == "true"); 250 result._disabled = (obj.disabled == "true");
251 251
252 return result; 252 return result;
253 } 253 };
254 254
255 /** 255 /**
256 * Class for special filter subscriptions (user's filters) 256 * Class for special filter subscriptions (user's filters)
257 * @param {String} url see Subscription() 257 * @param {String} url see Subscription()
258 * @param {String} [title] see Subscription() 258 * @param {String} [title] see Subscription()
259 * @constructor 259 * @constructor
260 * @augments Subscription 260 * @augments Subscription
261 */ 261 */
262 function SpecialSubscription(url, title) 262 function SpecialSubscription(url, title)
263 { 263 {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 * @param {String} [title] title of the new filter group 322 * @param {String} [title] title of the new filter group
323 * @result {SpecialSubscription} 323 * @result {SpecialSubscription}
324 */ 324 */
325 SpecialSubscription.create = function(title) 325 SpecialSubscription.create = function(title)
326 { 326 {
327 let url; 327 let url;
328 do 328 do
329 { 329 {
330 url = "~user~" + Math.round(Math.random()*1000000); 330 url = "~user~" + Math.round(Math.random()*1000000);
331 } while (url in Subscription.knownSubscriptions); 331 } while (url in Subscription.knownSubscriptions);
332 return new SpecialSubscription(url, title) 332 return new SpecialSubscription(url, title);
333 }; 333 };
334 334
335 /** 335 /**
336 * Creates a new user-defined filter group and adds the given filter to it. 336 * Creates a new user-defined filter group and adds the given filter to it.
337 * This group will act as the default group for this filter type. 337 * This group will act as the default group for this filter type.
338 */ 338 */
339 SpecialSubscription.createForFilter = function(/**Filter*/ filter) /**SpecialSub scription*/ 339 SpecialSubscription.createForFilter = function(/**Filter*/ filter) /**SpecialSub scription*/
340 { 340 {
341 let subscription = SpecialSubscription.create(); 341 let subscription = SpecialSubscription.create();
342 subscription.filters.push(filter); 342 subscription.filters.push(filter);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 { 418 {
419 Subscription.prototype.serialize.call(this, buffer); 419 Subscription.prototype.serialize.call(this, buffer);
420 if (this._homepage) 420 if (this._homepage)
421 buffer.push("homepage=" + this._homepage); 421 buffer.push("homepage=" + this._homepage);
422 if (this._lastDownload) 422 if (this._lastDownload)
423 buffer.push("lastDownload=" + this._lastDownload); 423 buffer.push("lastDownload=" + this._lastDownload);
424 } 424 }
425 }; 425 };
426 426
427 /** 427 /**
428 * Class for filter subscriptions updated by externally (by other extension) 428 * Class for filter subscriptions updated externally (by other extension)
429 * @param {String} url see Subscription() 429 * @param {String} url see Subscription()
430 * @param {String} [title] see Subscription() 430 * @param {String} [title] see Subscription()
431 * @constructor 431 * @constructor
432 * @augments RegularSubscription 432 * @augments RegularSubscription
433 */ 433 */
434 function ExternalSubscription(url, title) 434 function ExternalSubscription(url, title)
435 { 435 {
436 RegularSubscription.call(this, url, title); 436 RegularSubscription.call(this, url, title);
437 } 437 }
438 exports.ExternalSubscription = ExternalSubscription; 438 exports.ExternalSubscription = ExternalSubscription;
439 439
440 ExternalSubscription.prototype = 440 ExternalSubscription.prototype =
441 { 441 {
442 __proto__: RegularSubscription.prototype, 442 __proto__: RegularSubscription.prototype,
443 443
444 /** 444 /**
445 * See Subscription.serialize() 445 * See Subscription.serialize()
446 */ 446 */
447 serialize: function(buffer) 447 serialize: function(buffer)
448 { 448 {
449 throw new Error("Unexpected call, external subscriptions should not be seria lized"); 449 throw new Error("Unexpected call, external subscriptions should not be seria lized");
450 } 450 }
451 }; 451 };
452 452
453 /** 453 /**
454 * Class for filter subscriptions updated by externally (by other extension) 454 * Class for filter subscriptions updated externally (by other extension)
455 * @param {String} url see Subscription() 455 * @param {String} url see Subscription()
456 * @param {String} [title] see Subscription() 456 * @param {String} [title] see Subscription()
457 * @constructor 457 * @constructor
458 * @augments RegularSubscription 458 * @augments RegularSubscription
459 */ 459 */
460 function DownloadableSubscription(url, title) 460 function DownloadableSubscription(url, title)
461 { 461 {
462 RegularSubscription.call(this, url, title); 462 RegularSubscription.call(this, url, title);
463 } 463 }
464 exports.DownloadableSubscription = DownloadableSubscription; 464 exports.DownloadableSubscription = DownloadableSubscription;
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 * Minimal Adblock Plus version required for this subscription 555 * Minimal Adblock Plus version required for this subscription
556 * @type String 556 * @type String
557 */ 557 */
558 requiredVersion: null, 558 requiredVersion: null,
559 559
560 /** 560 /**
561 * Should be true if requiredVersion is higher than current Adblock Plus versi on 561 * Should be true if requiredVersion is higher than current Adblock Plus versi on
562 * @type Boolean 562 * @type Boolean
563 */ 563 */
564 upgradeRequired: false, 564 upgradeRequired: false,
565 565
566 /** 566 /**
567 * Number indicating how often the object was downloaded. 567 * Number indicating how often the object was downloaded.
568 * @type Number 568 * @type Number
569 */ 569 */
570 downloadCount: 0, 570 downloadCount: 0,
571 571
572 /** 572 /**
573 * See Subscription.serialize() 573 * See Subscription.serialize()
574 */ 574 */
575 serialize: function(buffer) 575 serialize: function(buffer)
(...skipping 12 matching lines...) Expand all
588 if (this.errors) 588 if (this.errors)
589 buffer.push("errors=" + this.errors); 589 buffer.push("errors=" + this.errors);
590 if (this.version) 590 if (this.version)
591 buffer.push("version=" + this.version); 591 buffer.push("version=" + this.version);
592 if (this.requiredVersion) 592 if (this.requiredVersion)
593 buffer.push("requiredVersion=" + this.requiredVersion); 593 buffer.push("requiredVersion=" + this.requiredVersion);
594 if (this.downloadCount) 594 if (this.downloadCount)
595 buffer.push("downloadCount=" + this.downloadCount); 595 buffer.push("downloadCount=" + this.downloadCount);
596 } 596 }
597 }; 597 };
OLDNEW
« no previous file with comments | « lib/filterClasses.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld