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

Delta Between Two Patch Sets: lib/snippets.js

Issue 29865583: Issue 6886 - Return snippet filters instead of just scripts (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Left Patch Set: rename it getFiltersForDomain Created Aug. 27, 2018, 12:13 p.m.
Right Patch Set: Fixed nit in test Created Aug. 27, 2018, 12:53 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 | « no previous file | test/snippets.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-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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 * @param {SnippetFilter} filter 56 * @param {SnippetFilter} filter
57 */ 57 */
58 remove(filter) 58 remove(filter)
59 { 59 {
60 filters.delete(filter.text); 60 filters.delete(filter.text);
61 }, 61 },
62 62
63 /** 63 /**
64 * Returns a list of all snippet filters active on a particular domain 64 * Returns a list of all snippet filters active on a particular domain
65 * @param {string} domain 65 * @param {string} domain
66 * @return {Filter[]} 66 * @return {Array.<SnippetFilter>}
67 */ 67 */
68 getSnippetsForDomain(domain) 68 getFiltersForDomain(domain)
69 { 69 {
70 let result = []; 70 let result = [];
71 for (let text of filters) 71 for (let text of filters)
72 { 72 {
73 let filter = Filter.fromText(text); 73 let filter = Filter.fromText(text);
74 if (filter.isActiveOnDomain(domain)) 74 if (filter.isActiveOnDomain(domain))
75 result.push(filter); 75 result.push(filter);
76 } 76 }
77 return result; 77 return result;
78 } 78 }
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 let value = imports[name]; 188 let value = imports[name];
189 if (typeof value == "function") 189 if (typeof value == "function")
190 value(...args); 190 value(...args);
191 } 191 }
192 } 192 }
193 } 193 }
194 `; 194 `;
195 } 195 }
196 196
197 exports.compileScript = compileScript; 197 exports.compileScript = compileScript;
LEFTRIGHT
« no previous file | test/snippets.js » ('j') | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld