Make parser take into account filterOnHeaders setting

Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1134#issuecomment-1460638431
This commit is contained in:
Raymond Hill 2023-03-08 13:49:21 -05:00
parent bbd9470a98
commit 890aabaae9
No known key found for this signature in database
GPG key ID: 25E1490B761470C2
3 changed files with 3 additions and 1 deletions

View file

@ -288,6 +288,7 @@ CodeMirror.defineMode('ubo-static-filtering', function() {
hintHelperRegistered = true;
initHints();
}
astParser.options.filterOnHeaders = details.filterOnHeaders === true;
},
parser: astParser,
};

View file

@ -1519,6 +1519,7 @@ const onMessage = function(request, sender, callback) {
response.preparseDirectiveHints =
sfp.utils.preparser.getHints();
response.expertMode = µb.hiddenSettings.filterAuthorMode;
response.filterOnHeaders = µb.hiddenSettings.filterOnHeaders;
}
if ( request.hintUpdateToken !== µb.pageStoresToken ) {
response.originHints = getOriginHints();

View file

@ -1221,7 +1221,7 @@ export class AstFilterParser {
realBad = isException === false || isNegated || hasValue;
break;
case NODE_TYPE_NET_OPTION_NAME_HEADER:
realBad = this.expertMode === false || isNegated || hasValue === false;
realBad = this.options.filterOnHeaders !== true || isNegated || hasValue === false;
break;
case NODE_TYPE_NET_OPTION_NAME_IMPORTANT:
realBad = isException || isNegated || hasValue;