mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-25 03:43:25 +01:00
[mv3] Fix regression in extended filtering with some lists
Related issue: https://github.com/uBlockOrigin/uBOL-home/issues/236 Regression from: https://github.com/gorhill/uBlock/commit/58bfe4c846 Cosmetic- and scriptlet injection-based filters broke with filter lists using AdGuard's `[$domain=/.../]` syntax. Potentially affected filter lists: - AdGuard Chinese - AdGuard Turkish
This commit is contained in:
parent
12435d96cc
commit
d4f15ca635
@ -19,12 +19,6 @@
|
||||
Home: https://github.com/gorhill/uBlock
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
import staticNetFilteringEngine from './static-net-filtering.js';
|
||||
import { LineIterator } from './text-utils.js';
|
||||
import * as sfp from './static-filtering-parser.js';
|
||||
|
||||
import {
|
||||
@ -32,6 +26,9 @@ import {
|
||||
CompiledListWriter,
|
||||
} from './static-filtering-io.js';
|
||||
|
||||
import { LineIterator } from './text-utils.js';
|
||||
import staticNetFilteringEngine from './static-net-filtering.js';
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
// http://www.cse.yorku.ca/~oz/hash.html#djb2
|
||||
@ -47,13 +44,15 @@ const hashFromStr = (type, s) => {
|
||||
return hash & 0xFFFFFF;
|
||||
};
|
||||
|
||||
const isRegex = hn => hn.startsWith('/') && hn.endsWith('/');
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
// Copied from cosmetic-filter.js for the time being to avoid unwanted
|
||||
// dependencies
|
||||
|
||||
const rePlainSelector = /^[#.][\w\\-]+/;
|
||||
const rePlainSelectorEx = /^[^#.\[(]+([#.][\w-]+)|([#.][\w-]+)$/;
|
||||
const rePlainSelectorEx = /^[^#.[(]+([#.][\w-]+)|([#.][\w-]+)$/;
|
||||
const rePlainSelectorEscaped = /^[#.](?:\\[0-9A-Fa-f]+ |\\.|\w|-)+/;
|
||||
const reEscapeSequence = /\\([0-9A-Fa-f]+ |.)/g;
|
||||
|
||||
@ -106,6 +105,7 @@ function addExtendedToDNR(context, parser) {
|
||||
for ( const { hn, not, bad } of parser.getExtFilterDomainIterator() ) {
|
||||
if ( bad ) { continue; }
|
||||
if ( exception ) { continue; }
|
||||
if ( isRegex(hn) ) { continue; }
|
||||
let details = context.scriptletFilters.get(argsToken);
|
||||
if ( details === undefined ) {
|
||||
context.scriptletFilters.set(argsToken, details = { args });
|
||||
@ -163,6 +163,7 @@ function addExtendedToDNR(context, parser) {
|
||||
};
|
||||
for ( const { hn, not, bad } of parser.getExtFilterDomainIterator() ) {
|
||||
if ( bad ) { continue; }
|
||||
if ( isRegex(hn) ) { continue; }
|
||||
if ( not ) {
|
||||
if ( rule.condition.excludedInitiatorDomains === undefined ) {
|
||||
rule.condition.excludedInitiatorDomains = [];
|
||||
@ -235,6 +236,7 @@ function addExtendedToDNR(context, parser) {
|
||||
}
|
||||
for ( const { hn, not, bad } of parser.getExtFilterDomainIterator() ) {
|
||||
if ( bad ) { continue; }
|
||||
if ( isRegex(hn) ) { continue; }
|
||||
let { compiled, exception, raw } = parser.result;
|
||||
if ( exception ) { continue; }
|
||||
let rejected;
|
||||
|
Loading…
Reference in New Issue
Block a user