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

Side by Side Diff: test/filterListener.js

Issue 29935564: Issue 7452 - Do not cache element hiding filter objects by default Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Rename filter* to filterText* Created Nov. 23, 2018, 2:01 a.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/elemHide.js ('K') | « test/elemHide.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 12 matching lines...) Expand all
23 let filterStorage = null; 23 let filterStorage = null;
24 let Subscription = null; 24 let Subscription = null;
25 let Filter = null; 25 let Filter = null;
26 let defaultMatcher = null; 26 let defaultMatcher = null;
27 let SpecialSubscription = null; 27 let SpecialSubscription = null;
28 28
29 exports.setUp = function(callback) 29 exports.setUp = function(callback)
30 { 30 {
31 sandboxedRequire = createSandbox({ 31 sandboxedRequire = createSandbox({
32 extraExports: { 32 extraExports: {
33 elemHide: ["knownFilters"], 33 elemHide: ["knownFilterText"],
34 elemHideEmulation: ["filters"], 34 elemHideEmulation: ["filters"],
35 elemHideExceptions: ["knownExceptions"], 35 elemHideExceptions: ["knownExceptions"],
36 snippets: ["filters"] 36 snippets: ["filters"]
37 } 37 }
38 }); 38 });
39 39
40 // We need to require the filterListener module so that filter changes will be 40 // We need to require the filterListener module so that filter changes will be
41 // noticed, even though we don't directly use the module here. 41 // noticed, even though we don't directly use the module here.
42 sandboxedRequire("../lib/filterListener"); 42 sandboxedRequire("../lib/filterListener");
43 43
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 "Keyword of filter " + filter.text); 77 "Keyword of filter " + filter.text);
78 filters.push(filter.text); 78 filters.push(filter.text);
79 } 79 }
80 } 80 }
81 } 81 }
82 result[type] = filters; 82 result[type] = filters;
83 } 83 }
84 84
85 let elemHide = sandboxedRequire("../lib/elemHide"); 85 let elemHide = sandboxedRequire("../lib/elemHide");
86 result.elemhide = []; 86 result.elemhide = [];
87 for (let filter of elemHide.knownFilters) 87 for (let filterText of elemHide.knownFilterText)
88 result.elemhide.push(filter.text); 88 result.elemhide.push(filterText);
89 89
90 let elemHideExceptions = sandboxedRequire("../lib/elemHideExceptions"); 90 let elemHideExceptions = sandboxedRequire("../lib/elemHideExceptions");
91 result.elemhideexception = []; 91 result.elemhideexception = [];
92 for (let exception of elemHideExceptions.knownExceptions) 92 for (let exception of elemHideExceptions.knownExceptions)
93 result.elemhideexception.push(exception.text); 93 result.elemhideexception.push(exception.text);
94 94
95 let elemHideEmulation = sandboxedRequire("../lib/elemHideEmulation"); 95 let elemHideEmulation = sandboxedRequire("../lib/elemHideEmulation");
96 result.elemhideemulation = []; 96 result.elemhideemulation = [];
97 for (let filter of elemHideEmulation.filters) 97 for (let filter of elemHideEmulation.filters)
98 result.elemhideemulation.push(filter.text); 98 result.elemhideemulation.push(filter.text);
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 checkKnownFilters(test, "add special subscription with filter2", {snippets: [f ilter1.text, filter2.text]}); 368 checkKnownFilters(test, "add special subscription with filter2", {snippets: [f ilter1.text, filter2.text]});
369 369
370 let subscription4 = Subscription.fromURL("https://easylist-downloads.adblockpl us.org/abp-filters-anti-cv.txt"); 370 let subscription4 = Subscription.fromURL("https://easylist-downloads.adblockpl us.org/abp-filters-anti-cv.txt");
371 subscription4.addFilter(filter3); 371 subscription4.addFilter(filter3);
372 372
373 filterStorage.addSubscription(subscription4); 373 filterStorage.addSubscription(subscription4);
374 checkKnownFilters(test, "add ABP anti-circumvention subscription with filter3" , {snippets: [filter1.text, filter2.text, filter3.text]}); 374 checkKnownFilters(test, "add ABP anti-circumvention subscription with filter3" , {snippets: [filter1.text, filter2.text, filter3.text]});
375 375
376 test.done(); 376 test.done();
377 }; 377 };
OLDNEW
« lib/elemHide.js ('K') | « test/elemHide.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld