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

Side by Side Diff: test/filterClasses.js

Issue 29550662: Issue 5735 - Use JS Map instead of Object for property domains of Filter objects (Closed) Base URL: https://github.com/adblockplus/adblockpluscore.git
Patch Set: Created Sept. 20, 2017, 12:59 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
« lib/filterClasses.js ('K') | « 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-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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 result.push("type=comment"); 64 result.push("type=comment");
65 else if (filter instanceof ActiveFilter) 65 else if (filter instanceof ActiveFilter)
66 { 66 {
67 result.push("disabled=" + filter.disabled); 67 result.push("disabled=" + filter.disabled);
68 result.push("lastHit=" + filter.lastHit); 68 result.push("lastHit=" + filter.lastHit);
69 result.push("hitCount=" + filter.hitCount); 69 result.push("hitCount=" + filter.hitCount);
70 70
71 let domains = []; 71 let domains = [];
72 if (filter.domains) 72 if (filter.domains)
73 { 73 {
74 for (let domain in filter.domains) 74 for (let [domain, isIncluded] of filter.domains)
75 { 75 {
76 if (domain != "") 76 if (domain != "")
77 domains.push(filter.domains[domain] ? domain : "~" + domain); 77 domains.push(isIncluded ? domain : "~" + domain);
78 } 78 }
79 } 79 }
80 result.push("domains=" + domains.sort().join("|")); 80 result.push("domains=" + domains.sort().join("|"));
81 81
82 if (filter instanceof RegExpFilter) 82 if (filter instanceof RegExpFilter)
83 { 83 {
84 result.push("regexp=" + filter.regexp.source); 84 result.push("regexp=" + filter.regexp.source);
85 result.push("contentType=" + filter.contentType); 85 result.push("contentType=" + filter.contentType);
86 result.push("matchCase=" + filter.matchCase); 86 result.push("matchCase=" + filter.matchCase);
87 87
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 test, "foo.com#?#:-abp-properties(/margin: [3-4]{2}/)", [ 399 test, "foo.com#?#:-abp-properties(/margin: [3-4]{2}/)", [
400 "type=elemhideemulation", 400 "type=elemhideemulation",
401 "text=foo.com#?#:-abp-properties(/margin: [3-4]{2}/)", 401 "text=foo.com#?#:-abp-properties(/margin: [3-4]{2}/)",
402 "selectorDomain=foo.com", 402 "selectorDomain=foo.com",
403 "selector=:-abp-properties(/margin: [3-4]\\x7B 2\\x7D /)", 403 "selector=:-abp-properties(/margin: [3-4]\\x7B 2\\x7D /)",
404 "domains=FOO.COM" 404 "domains=FOO.COM"
405 ] 405 ]
406 ); 406 );
407 test.done(); 407 test.done();
408 }; 408 };
OLDNEW
« lib/filterClasses.js ('K') | « lib/filterClasses.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld