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

Delta Between Two Patch Sets: lib/filterClasses.js

Issue 29361668: Issue 4394 - Create a filter class for element hiding emulation filters (Closed) Base URL: https://bitbucket.org/fhd/adblockpluscore
Left Patch Set: Address Wladimir's comments Created Nov. 21, 2016, 2:34 p.m.
Right Patch Set: Improve compliance with the 80 column rule Created Nov. 21, 2016, 8:10 p.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/elemHideEmulation.js ('k') | lib/filterListener.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-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 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 894 matching lines...) Expand 10 before | Expand all | Expand 10 after
905 905
906 // We don't allow ElemHide filters which have any empty domains. 906 // We don't allow ElemHide filters which have any empty domains.
907 // Note: The ElemHide.prototype.domainSeparator is duplicated here, if that 907 // Note: The ElemHide.prototype.domainSeparator is duplicated here, if that
908 // changes this must be changed too. 908 // changes this must be changed too.
909 if (domain && /(^|,)~?(,|$)/.test(domain)) 909 if (domain && /(^|,)~?(,|$)/.test(domain))
910 return new InvalidFilter(text, "filter_invalid_domain"); 910 return new InvalidFilter(text, "filter_invalid_domain");
911 911
912 if (isException) 912 if (isException)
913 return new ElemHideException(text, domain, selector); 913 return new ElemHideException(text, domain, selector);
914 914
915 if (selector.indexOf("[-abp-properties") != -1 || 915 if (selector.indexOf("[-abp-properties") != -1)
916 selector.indexOf(":has(") != -1)
kzar 2016/11/21 16:24:55 You're still checking for ":has".
Felix Dahlke 2016/11/21 17:26:12 Done.
917 { 916 {
918 // Element hiding emulation filters are inefficient so we need to make sure 917 // Element hiding emulation filters are inefficient so we need to make sure
919 // that they're only applied if they specify active domains 918 // that they're only applied if they specify active domains
920 if (!/,[^~][^,.]*\.[^,]/.test("," + domain)) 919 if (!/,[^~][^,.]*\.[^,]/.test("," + domain))
921 return new InvalidFilter(text, "filter_elemhideemulation_nodomain"); 920 return new InvalidFilter(text, "filter_elemhideemulation_nodomain");
922 921
923 return new ElemHideEmulationFilter(text, domain, selector); 922 return new ElemHideEmulationFilter(text, domain, selector);
924 } 923 }
925 924
926 return new ElemHideFilter(text, domain, selector); 925 return new ElemHideFilter(text, domain, selector);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
972 */ 971 */
973 function ElemHideEmulationFilter(text, domains, selector) 972 function ElemHideEmulationFilter(text, domains, selector)
974 { 973 {
975 ElemHideBase.call(this, text, domains, selector); 974 ElemHideBase.call(this, text, domains, selector);
976 } 975 }
977 exports.ElemHideEmulationFilter = ElemHideEmulationFilter; 976 exports.ElemHideEmulationFilter = ElemHideEmulationFilter;
978 977
979 ElemHideEmulationFilter.prototype = extend(ElemHideBase, { 978 ElemHideEmulationFilter.prototype = extend(ElemHideBase, {
980 type: "elemhideemulation" 979 type: "elemhideemulation"
981 }); 980 });
LEFTRIGHT

Powered by Google App Engine
This is Rietveld