Fix dumping of CFE internals when no cosmetic filters present

This commit is contained in:
Raymond Hill 2023-10-09 11:12:10 -04:00
parent 780383faef
commit 0a18f75897
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
2 changed files with 9 additions and 7 deletions

View File

@ -961,9 +961,8 @@ FilterContainer.prototype.dump = function() {
lowlyGenerics.push(...selectors.split(',\n'));
}
lowlyGenerics.sort();
const highlyGenerics = Array.from(this.highlyGeneric.simple.dict);
highlyGenerics.push(Array.from(this.highlyGeneric.complex.dict));
highlyGenerics.sort();
const highlyGenerics = Array.from(this.highlyGeneric.simple.dict).sort();
highlyGenerics.push(...Array.from(this.highlyGeneric.complex.dict).sort());
return [
'Cosmetic Filtering Engine internals:',
`specific: ${this.specificFilters.size}`,

View File

@ -240,11 +240,14 @@ const onMessage = function(request, sender, callback) {
);
out.push(`+ Unsupported filters (${bad.length}): ${JSON.stringify(bad, replacer, 2)}`);
out.push(`+ generichide exclusions (${network.generichideExclusions.length}): ${JSON.stringify(network.generichideExclusions, replacer, 2)}`);
if ( result.specificCosmetic ) {
out.push(`+ Cosmetic filters: ${result.specificCosmetic.size}`);
for ( const details of result.specificCosmetic ) {
out.push(` ${JSON.stringify(details)}`);
}
} else {
out.push(' Cosmetic filters: 0');
}
callback(out.join('\n'));
});
return;