1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-18 17:02:27 +02:00

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; hintHelperRegistered = true;
initHints(); initHints();
} }
astParser.options.filterOnHeaders = details.filterOnHeaders === true;
}, },
parser: astParser, parser: astParser,
}; };

View File

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

View File

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