Skip to content

Commit

Permalink
Fix regression in handling of experimental header= filter option
Browse files Browse the repository at this point in the history
Also completed fix for reverse lookup issues related to `header=`
filter option:
uBlockOrigin/uBlock-issues#1932
  • Loading branch information
gorhill committed Jul 14, 2023
1 parent 0da7e12 commit aa6baf9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/js/1p-filters.js
Expand Up @@ -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);
}
Expand Down
3 changes: 2 additions & 1 deletion src/js/reverselookup.js
Expand Up @@ -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);

Expand Down
3 changes: 2 additions & 1 deletion src/js/storage.js
Expand Up @@ -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(
Expand Down

0 comments on commit aa6baf9

Please sign in to comment.