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

Unified Diff: lib/snippets.js

Issue 29929561: Issue 7074 - Keep filter objects instead of text (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created Oct. 28, 2018, 11:46 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/elemHideEmulation.js ('k') | test/filterListener.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/snippets.js
===================================================================
--- a/lib/snippets.js
+++ b/lib/snippets.js
@@ -17,17 +17,16 @@
"use strict";
/**
* @fileOverview Snippets implementation.
*/
const {EventEmitter} = require("./events");
-const {Filter} = require("./filterClasses");
const singleCharacterEscapes = new Map([
["n", "\n"], ["r", "\r"], ["t", "\t"]
]);
let filters = new Set();
/**
@@ -51,47 +50,46 @@
/**
* Add a new snippet filter
* @param {SnippetFilter} filter
*/
add(filter)
{
let {size} = filters;
- filters.add(filter.text);
+ filters.add(filter);
if (size != filters.size)
this.emit("snippets.filterAdded", filter);
},
/**
* Removes a snippet filter
* @param {SnippetFilter} filter
*/
remove(filter)
{
let {size} = filters;
- filters.delete(filter.text);
+ filters.delete(filter);
if (size != filters.size)
this.emit("snippets.filterRemoved", filter);
},
/**
* Returns a list of all snippet filters active on a particular domain
* @param {string} domain
* @return {Array.<SnippetFilter>}
*/
getFiltersForDomain(domain)
{
let result = [];
- for (let text of filters)
+ for (let filter of filters)
{
- let filter = Filter.fromText(text);
if (filter.isActiveOnDomain(domain))
result.push(filter);
}
return result;
}
});
exports.Snippets = Snippets;
« no previous file with comments | « lib/elemHideEmulation.js ('k') | test/filterListener.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld