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

Side by Side Diff: lib/filterClasses.js

Issue 29737555: Noissue - Check for null and blank string instead of undefined (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created March 30, 2018, 1:54 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 | « no previous file | 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-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 775 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 value = option.substr(separatorIndex + 1); 786 value = option.substr(separatorIndex + 1);
787 option = option.substr(0, separatorIndex); 787 option = option.substr(0, separatorIndex);
788 } 788 }
789 option = option.replace(/-/, "_").toUpperCase(); 789 option = option.replace(/-/, "_").toUpperCase();
790 if (option in RegExpFilter.typeMap) 790 if (option in RegExpFilter.typeMap)
791 { 791 {
792 if (contentType == null) 792 if (contentType == null)
793 contentType = 0; 793 contentType = 0;
794 contentType |= RegExpFilter.typeMap[option]; 794 contentType |= RegExpFilter.typeMap[option];
795 795
796 if (option == "CSP" && typeof value != "undefined") 796 if (option == "CSP" && value)
797 csp = value; 797 csp = value;
798 } 798 }
799 else if (option[0] == "~" && option.substr(1) in RegExpFilter.typeMap) 799 else if (option[0] == "~" && option.substr(1) in RegExpFilter.typeMap)
800 { 800 {
801 if (contentType == null) 801 if (contentType == null)
802 ({contentType} = RegExpFilter.prototype); 802 ({contentType} = RegExpFilter.prototype);
803 contentType &= ~RegExpFilter.typeMap[option.substr(1)]; 803 contentType &= ~RegExpFilter.typeMap[option.substr(1)];
804 } 804 }
805 else if (option == "MATCH_CASE") 805 else if (option == "MATCH_CASE")
806 matchCase = true; 806 matchCase = true;
807 else if (option == "~MATCH_CASE") 807 else if (option == "~MATCH_CASE")
808 matchCase = false; 808 matchCase = false;
809 else if (option == "DOMAIN" && typeof value != "undefined") 809 else if (option == "DOMAIN" && value)
810 domains = value.toUpperCase(); 810 domains = value.toUpperCase();
811 else if (option == "THIRD_PARTY") 811 else if (option == "THIRD_PARTY")
812 thirdParty = true; 812 thirdParty = true;
813 else if (option == "~THIRD_PARTY") 813 else if (option == "~THIRD_PARTY")
814 thirdParty = false; 814 thirdParty = false;
815 else if (option == "COLLAPSE") 815 else if (option == "COLLAPSE")
816 collapse = true; 816 collapse = true;
817 else if (option == "~COLLAPSE") 817 else if (option == "~COLLAPSE")
818 collapse = false; 818 collapse = false;
819 else if (option == "SITEKEY" && typeof value != "undefined") 819 else if (option == "SITEKEY" && value)
820 sitekeys = value.toUpperCase(); 820 sitekeys = value.toUpperCase();
821 else 821 else
822 return new InvalidFilter(origText, "filter_unknown_option"); 822 return new InvalidFilter(origText, "filter_unknown_option");
823 } 823 }
824 } 824 }
825 825
826 try 826 try
827 { 827 {
828 if (blocking) 828 if (blocking)
829 { 829 {
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
1080 */ 1080 */
1081 function ElemHideEmulationFilter(text, domains, selector) 1081 function ElemHideEmulationFilter(text, domains, selector)
1082 { 1082 {
1083 ElemHideBase.call(this, text, domains, selector); 1083 ElemHideBase.call(this, text, domains, selector);
1084 } 1084 }
1085 exports.ElemHideEmulationFilter = ElemHideEmulationFilter; 1085 exports.ElemHideEmulationFilter = ElemHideEmulationFilter;
1086 1086
1087 ElemHideEmulationFilter.prototype = extend(ElemHideBase, { 1087 ElemHideEmulationFilter.prototype = extend(ElemHideBase, {
1088 type: "elemhideemulation" 1088 type: "elemhideemulation"
1089 }); 1089 });
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld