Fix regression in handling of experimental `header=` filter option

Also completed fix for reverse lookup issues related to `header=`
filter option:
https://github.com/uBlockOrigin/uBlock-issues/issues/1932
This commit is contained in:
Raymond Hill 2023-07-14 09:02:10 -04:00
parent 0da7e12ea4
commit aa6baf9a29
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
3 changed files with 7 additions and 3 deletions

View File

@ -70,7 +70,9 @@ let cachedUserFilters = '';
if ( response instanceof Object === false ) { return; }
if ( response.hintUpdateToken !== undefined ) {
const mode = cmEditor.getMode();
cmEditor.setOption('filterOnHeaders', response.filterOnHeaders === true);
if ( typeof response.filterOnHeaders === 'boolean' ) {
cmEditor.setOption('filterOnHeaders', response.filterOnHeaders);
}
if ( mode.setHints instanceof Function ) {
mode.setHints(response);
}

View File

@ -131,8 +131,9 @@ const fromNetFilter = async function(rawFilter) {
const writer = new CompiledListWriter();
const parser = new sfp.AstFilterParser({
expertMode: true,
nativeCssHas: vAPI.webextFlavor.env.includes('native_css_has'),
filterOnHeaders: true,
maxTokenLength: staticNetFilteringEngine.MAX_TOKEN_LENGTH,
nativeCssHas: vAPI.webextFlavor.env.includes('native_css_has'),
});
parser.parse(rawFilter);

View File

@ -1051,8 +1051,9 @@ self.addEventListener('hiddenSettingsChanged', ( ) => {
this.hiddenSettings.filterAuthorMode !== false;
const parser = new sfp.AstFilterParser({
expertMode,
nativeCssHas: vAPI.webextFlavor.env.includes('native_css_has'),
filterOnHeaders: µb.hiddenSettings.filterOnHeaders,
maxTokenLength: staticNetFilteringEngine.MAX_TOKEN_LENGTH,
nativeCssHas: vAPI.webextFlavor.env.includes('native_css_has'),
});
const compiler = staticNetFilteringEngine.createCompiler(parser);
const lineIter = new LineIterator(