Skip to content

Commit

Permalink
Properly handle converted procedural filters in logger
Browse files Browse the repository at this point in the history
  • Loading branch information
gorhill committed Apr 29, 2023
1 parent a3b74cd commit 5fd35ff
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/js/contentscript.js
Expand Up @@ -663,9 +663,9 @@ vAPI.DOMFilterer = class {
const proceduralFilterer = this.proceduralFiltererInstance();
if ( proceduralFilterer !== null ) {
for ( const json of this.convertedProceduralFilters ) {
out.procedural.push(
proceduralFilterer.createProceduralFilter(json)
);
const pfilter = proceduralFilterer.createProceduralFilter(json);
pfilter.converted = true;
out.procedural.push(pfilter);
}
}
}
Expand Down
8 changes: 5 additions & 3 deletions src/js/scriptlets/cosmetic-logger.js
Expand Up @@ -141,16 +141,18 @@ const processDeclarativeComplex = function(out) {

/******************************************************************************/

const processProcedural = function(out) {
function processProcedural(out) {
if ( proceduralDict.size === 0 ) { return; }
for ( const [ raw, pselector ] of proceduralDict ) {
if ( pselector.hit === false && pselector.exec().length === 0 ) {
if ( pselector.converted ) {
if ( safeQuerySelector(pselector.selector) === null ) { continue; }
} else if ( pselector.hit === false && pselector.exec().length === 0 ) {
continue;
}
out.push(`##${raw}`);
proceduralDict.delete(raw);
}
};
}

/******************************************************************************/

Expand Down

0 comments on commit 5fd35ff

Please sign in to comment.