mirror of https://github.com/gorhill/uBlock.git
Add ability to dump internal details of cosmetic filtering engine
Related commit:
- 4d482f9133
This commit is contained in:
parent
c198b9a748
commit
ba22735fcc
|
@ -22,8 +22,9 @@
|
|||
<div class="body">
|
||||
<p>
|
||||
<button id="console-clear" class="iconifiable" type="button"><span class="fa-icon">trash-o</span></button>
|
||||
<button id="snfe-dump" type="button">Dump SNFE</button>
|
||||
<button id="snfe-benchmark" type="button" disabled>Benchmark SNFE</button>
|
||||
<button id="snfe-dump" type="button">SNFE: Dump</button>
|
||||
<button id="snfe-benchmark" type="button" disabled>SNFE: Benchmark</button>
|
||||
<button id="cfe-dump" type="button">CFE: Dump</button>
|
||||
</div>
|
||||
<div id="console" class="codeMirrorContainer"></div>
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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');
|
||||
});
|
||||
});
|
||||
|
||||
/******************************************************************************/
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue