From aa6baf9a29db574038e7aad5373cecf7e48c5889 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Fri, 14 Jul 2023 09:02:10 -0400 Subject: [PATCH] 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 --- src/js/1p-filters.js | 4 +++- src/js/reverselookup.js | 3 ++- src/js/storage.js | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/js/1p-filters.js b/src/js/1p-filters.js index ce00759d2..645d231d5 100644 --- a/src/js/1p-filters.js +++ b/src/js/1p-filters.js @@ -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); } diff --git a/src/js/reverselookup.js b/src/js/reverselookup.js index 10616dc93..757c62108 100644 --- a/src/js/reverselookup.js +++ b/src/js/reverselookup.js @@ -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); diff --git a/src/js/storage.js b/src/js/storage.js index c9f4a83b8..3f742c015 100644 --- a/src/js/storage.js +++ b/src/js/storage.js @@ -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(