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: Rebased. Created Dec. 5, 2017, 6:03 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
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 {ElemHide} = require("elemHide");
-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
- * @return {ElemHideEmulationFilter[]}
- */
- getRulesForDomain(domain)
- {
- 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;

Powered by Google App Engine
This is Rietveld