diff --git a/src/js/cosmetic-filtering.js b/src/js/cosmetic-filtering.js index 62d7fd4b5..b7d1e6d86 100644 --- a/src/js/cosmetic-filtering.js +++ b/src/js/cosmetic-filtering.js @@ -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}`, diff --git a/src/js/messaging.js b/src/js/messaging.js index 1b394d088..3ad22bbcf 100644 --- a/src/js/messaging.js +++ b/src/js/messaging.js @@ -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)}`); - out.push(`+ Cosmetic filters: ${result.specificCosmetic.size}`); - for ( const details of result.specificCosmetic ) { - out.push(` ${JSON.stringify(details)}`); + 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;