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

Unified Diff: lib/elemHideEmulation.js

Issue 29594607: Issue 5143 - Convert ElemHideEmulation to C++ (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Review comments addressed Created Jan. 30, 2018, 5:37 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 | « compiled/bindings/main.cpp ('k') | meson.build » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/elemHideEmulation.js
===================================================================
--- a/lib/elemHideEmulation.js
+++ b/lib/elemHideEmulation.js
@@ -12,70 +12,11 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
*/
"use strict";
-/**
- * @fileOverview Element hiding emulation implementation.
- */
-
-const {Filter} = require("filterClasses");
-
-let filters = Object.create(null);
-
-/**
- * Container for element hiding emulation filters
- * @class
- */
-let ElemHideEmulation = {
- /**
- * Removes all known filters
- */
- clear()
- {
- filters = Object.create(null);
- },
-
- /**
- * Add a new element hiding emulation filter
- * @param {ElemHideEmulationFilter} filter
- */
- add(filter)
- {
- filters[filter.text] = true;
- },
+const {ElemHideEmulation} = require("compiled");
- /**
- * Removes an element hiding emulation filter
- * @param {ElemHideEmulationFilter} filter
- */
- remove(filter)
- {
- delete filters[filter.text];
- },
-
- /**
- * Returns a list of all rules active on a particular domain
- * @param {string} domain
- * @param {Object} elemHide the ElemHide instance
- * @return {ElemHideEmulationFilter[]}
- */
- getRulesForDomain(domain, elemHide)
- {
- let result = [];
- let keys = Object.getOwnPropertyNames(filters);
- for (let key of keys)
- {
- let filter = Filter.fromText(key);
- if (filter.isActiveOnDomain(domain) &&
- !elemHide.getException(filter, domain))
- {
- result.push(filter);
- }
- }
- return result;
- }
-};
exports.ElemHideEmulation = ElemHideEmulation;
« no previous file with comments | « compiled/bindings/main.cpp ('k') | meson.build » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld