This commit is contained in:
Raymond Hill 2018-11-18 05:56:13 -05:00
parent b2094cf188
commit a3051842bb
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 13 additions and 13 deletions

View File

@ -24,17 +24,17 @@
/******************************************************************************/ /******************************************************************************/
µBlock.htmlFilteringEngine = (function() { µBlock.htmlFilteringEngine = (function() {
var api = {}; const api = {};
var µb = µBlock, const µb = µBlock,
filterDB = new µb.staticExtFilteringEngine.HostnameBasedDB(),
pselectors = new Map(), pselectors = new Map(),
duplicates = new Set(), duplicates = new Set();
let filterDB = new µb.staticExtFilteringEngine.HostnameBasedDB(),
acceptedCount = 0, acceptedCount = 0,
discardedCount = 0, discardedCount = 0,
docRegister; docRegister;
var PSelectorHasTextTask = function(task) { const PSelectorHasTextTask = function(task) {
let arg0 = task[1], arg1; let arg0 = task[1], arg1;
if ( Array.isArray(task[1]) ) { if ( Array.isArray(task[1]) ) {
arg1 = arg0[1]; arg0 = arg0[0]; arg1 = arg0[1]; arg0 = arg0[0];
@ -51,7 +51,7 @@
return output; return output;
}; };
var PSelectorIfTask = function(task) { const PSelectorIfTask = function(task) {
this.pselector = new PSelector(task[1]); this.pselector = new PSelector(task[1]);
}; };
PSelectorIfTask.prototype.target = true; PSelectorIfTask.prototype.target = true;
@ -70,14 +70,14 @@
return output; return output;
}; };
var PSelectorIfNotTask = function(task) { const PSelectorIfNotTask = function(task) {
PSelectorIfTask.call(this, task); PSelectorIfTask.call(this, task);
this.target = false; this.target = false;
}; };
PSelectorIfNotTask.prototype = Object.create(PSelectorIfTask.prototype); PSelectorIfNotTask.prototype = Object.create(PSelectorIfTask.prototype);
PSelectorIfNotTask.prototype.constructor = PSelectorIfNotTask; PSelectorIfNotTask.prototype.constructor = PSelectorIfNotTask;
var PSelectorXpathTask = function(task) { const PSelectorXpathTask = function(task) {
this.xpe = task[1]; this.xpe = task[1];
}; };
PSelectorXpathTask.prototype.exec = function(input) { PSelectorXpathTask.prototype.exec = function(input) {
@ -101,7 +101,7 @@
return output; return output;
}; };
var PSelector = function(o) { const PSelector = function(o) {
if ( PSelector.prototype.operatorToTaskMap === undefined ) { if ( PSelector.prototype.operatorToTaskMap === undefined ) {
PSelector.prototype.operatorToTaskMap = new Map([ PSelector.prototype.operatorToTaskMap = new Map([
[ ':has', PSelectorIfTask ], [ ':has', PSelectorIfTask ],
@ -161,7 +161,7 @@
return false; return false;
}; };
var logOne = function(details, exception, selector) { const logOne = function(details, exception, selector) {
µb.logger.writeOne( µb.logger.writeOne(
details.tabId, details.tabId,
'cosmetic', 'cosmetic',
@ -176,7 +176,7 @@
); );
}; };
var applyProceduralSelector = function(details, selector) { const applyProceduralSelector = function(details, selector) {
let pselector = pselectors.get(selector); let pselector = pselectors.get(selector);
if ( pselector === undefined ) { if ( pselector === undefined ) {
pselector = new PSelector(JSON.parse(selector)); pselector = new PSelector(JSON.parse(selector));
@ -198,7 +198,7 @@
return modified; return modified;
}; };
var applyCSSSelector = function(details, selector) { const applyCSSSelector = function(details, selector) {
let nodes = docRegister.querySelectorAll(selector), let nodes = docRegister.querySelectorAll(selector),
i = nodes.length, i = nodes.length,
modified = false; modified = false;
@ -329,7 +329,7 @@
} }
if ( toRemoveMap.size === 0 ) { return; } if ( toRemoveMap.size === 0 ) { return; }
return Array.from(toRemoveMap); return Array.from(toRemoveMap.values());
}; };
api.apply = function(doc, details) { api.apply = function(doc, details) {