diff --git a/src/devtools.html b/src/devtools.html index 50a793829..e52494d13 100644 --- a/src/devtools.html +++ b/src/devtools.html @@ -22,8 +22,9 @@

- - + + +

diff --git a/src/js/cosmetic-filtering.js b/src/js/cosmetic-filtering.js index c5b89da95..58e215a09 100644 --- a/src/js/cosmetic-filtering.js +++ b/src/js/cosmetic-filtering.js @@ -1126,6 +1126,34 @@ FilterContainer.prototype.getFilterCount = function() { /******************************************************************************/ +FilterContainer.prototype.dump = function() { + return [ + 'Cosmetic Filtering Engine internals:', + `specific counts: ${this.specificFilters.size}`, + 'generic counts:', + ` lowly.id.simple: ${this.lowlyGeneric.id.simple.size}`, + ` lowly.class.simple: ${this.lowlyGeneric.cl.simple.size}`, + ` lowly.id.complex: ${this.lowlyGeneric.id.complex.size}`, + ` lowly.class.complex: ${this.lowlyGeneric.cl.complex.size}`, + ` highly.simple: ${this.highlyGeneric.simple.dict.size}`, + ` highly.complex: ${this.highlyGeneric.complex.dict.size}`, + `lowly.id.simple: ${this.lowlyGeneric.id.simple.size}`, + ...Array.from(this.lowlyGeneric.id.simple).map(a => ` ###${a}`), + `lowly.id.complex: ${this.lowlyGeneric.id.complex.size}`, + ...Array.from(this.lowlyGeneric.id.complex.values()).map(a => ` ###${a}`), + `lowly.class.simple: ${this.lowlyGeneric.cl.simple.size}`, + ...Array.from(this.lowlyGeneric.cl.simple).map(a => ` ##.${a}`), + `lowly.class.complex: ${this.lowlyGeneric.cl.complex.size}`, + ...Array.from(this.lowlyGeneric.cl.complex.values()).map(a => ` ##.${a}`), + `highly.simple: ${this.highlyGeneric.simple.dict.size}`, + ...Array.from(this.highlyGeneric.simple.dict).map(a => ` ##${a}`), + `highly.complex: ${this.lowlyGeneric.id.simple.size}`, + ...Array.from(this.highlyGeneric.complex.dict).map(a => ` ##${a}`), + ].join('\n'); +}; + +/******************************************************************************/ + const cosmeticFilteringEngine = new FilterContainer(); export default cosmeticFilteringEngine; diff --git a/src/js/devtools.js b/src/js/devtools.js index b3eccb43c..b683270dd 100644 --- a/src/js/devtools.js +++ b/src/js/devtools.js @@ -54,7 +54,7 @@ uDom.nodeFromId('snfe-dump').addEventListener('click', ev => { const button = ev.target; button.setAttribute('disabled', ''); vAPI.messaging.send('dashboard', { - what: 'sfneDump', + what: 'snfeDump', }).then(result => { log(result); button.removeAttribute('disabled'); @@ -70,7 +70,7 @@ vAPI.messaging.send('dashboard', { const button = ev.target; button.setAttribute('disabled', ''); vAPI.messaging.send('dashboard', { - what: 'sfneBenchmark', + what: 'snfeBenchmark', }).then(result => { log(result); button.removeAttribute('disabled'); @@ -78,4 +78,15 @@ vAPI.messaging.send('dashboard', { }); }); +uDom.nodeFromId('cfe-dump').addEventListener('click', ev => { + const button = ev.target; + button.setAttribute('disabled', ''); + vAPI.messaging.send('dashboard', { + what: 'cfeDump', + }).then(result => { + log(result); + button.removeAttribute('disabled'); + }); +}); + /******************************************************************************/ diff --git a/src/js/messaging.js b/src/js/messaging.js index 3094a1286..4aa038a4c 100644 --- a/src/js/messaging.js +++ b/src/js/messaging.js @@ -137,7 +137,7 @@ const onMessage = function(request, sender, callback) { }); return; - case 'sfneBenchmark': + case 'snfeBenchmark': µb.benchmarkStaticNetFiltering({ redirectEngine }).then(result => { callback(result); }); @@ -239,10 +239,14 @@ const onMessage = function(request, sender, callback) { } break; - case 'sfneDump': + case 'snfeDump': response = staticNetFilteringEngine.dump(); break; + case 'cfeDump': + response = cosmeticFilteringEngine.dump(); + break; + default: return vAPI.messaging.UNHANDLED; }