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

Delta Between Two Patch Sets: lib/filterClasses.js

Issue 5840485868371968: Issue 616 - Add $generichide + $genericblock filter options and enforce them. (Closed)
Left Patch Set: Improved logic based on Wladimir's suggestions Created Sept. 5, 2015, 2:35 p.m.
Right Patch Set: Remove extra parenthesis Created Sept. 28, 2015, 10:15 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/contentPolicy.js ('k') | no next file » | 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-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 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 472
473 for (let domain in this.domains) 473 for (let domain in this.domains)
474 if (this.domains[domain] && domain != docDomain && (domain.length <= docDo main.length || domain.indexOf("." + docDomain) != domain.length - docDomain.leng th - 1)) 474 if (this.domains[domain] && domain != docDomain && (domain.length <= docDo main.length || domain.indexOf("." + docDomain) != domain.length - docDomain.leng th - 1))
475 return false; 475 return false;
476 476
477 return true; 477 return true;
478 }, 478 },
479 479
480 /** 480 /**
481 * Checks whether this filter is generic or specific 481 * Checks whether this filter is generic or specific
482 * @return {Boolean} true if filter is generic, otherwise false
483 */ 482 */
484 isGeneric: function() /**Boolean*/ 483 isGeneric: function() /**Boolean*/
485 { 484 {
486 return (!(this.sitekeys && this.sitekeys.length) && 485 return !(this.sitekeys && this.sitekeys.length) &&
487 (!this.domains || this.domains[""])); 486 (!this.domains || this.domains[""]);
488 }, 487 },
489 488
490 /** 489 /**
491 * See Filter.serialize() 490 * See Filter.serialize()
492 */ 491 */
493 serialize: function(buffer) 492 serialize: function(buffer)
494 { 493 {
495 if (this._disabled || this._hitCount || this._lastHit) 494 if (this._disabled || this._hitCount || this._lastHit)
496 { 495 {
497 Filter.prototype.serialize.call(this, buffer); 496 Filter.prototype.serialize.call(this, buffer);
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
1038 // several times on Safari, due to WebKit bug 132872 1037 // several times on Safari, due to WebKit bug 132872
1039 let prop = Object.getOwnPropertyDescriptor(this, "regexpString"); 1038 let prop = Object.getOwnPropertyDescriptor(this, "regexpString");
1040 if (prop) 1039 if (prop)
1041 return prop.value; 1040 return prop.value;
1042 1041
1043 let regexp = Filter.toRegExp(this.regexpSource); 1042 let regexp = Filter.toRegExp(this.regexpSource);
1044 Object.defineProperty(this, "regexpString", {value: regexp}); 1043 Object.defineProperty(this, "regexpString", {value: regexp});
1045 return regexp; 1044 return regexp;
1046 } 1045 }
1047 }; 1046 };
LEFTRIGHT

Powered by Google App Engine
This is Rietveld