mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-07 03:12:33 +01:00
Ignore compilation hints when applying exception cosmetic filters
Related issue: - https://github.com/uBlockOrigin/uBlock-issues/issues/2475
This commit is contained in:
parent
6eec497ae8
commit
bc19a93815
@ -682,8 +682,7 @@ FilterContainer.prototype.disableSurveyor = function(details) {
|
|||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
FilterContainer.prototype.cssRuleFromProcedural = function(json) {
|
FilterContainer.prototype.cssRuleFromProcedural = function(pfilter) {
|
||||||
const pfilter = JSON.parse(json);
|
|
||||||
if ( pfilter.cssable !== true ) { return; }
|
if ( pfilter.cssable !== true ) { return; }
|
||||||
const { tasks, action } = pfilter;
|
const { tasks, action } = pfilter;
|
||||||
let mq;
|
let mq;
|
||||||
@ -839,15 +838,13 @@ FilterContainer.prototype.retrieveSpecificSelectors = function(
|
|||||||
2
|
2
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Apply exceptions to specific filterset
|
||||||
if ( exceptionSet.size !== 0 ) {
|
if ( exceptionSet.size !== 0 ) {
|
||||||
out.exceptionFilters = Array.from(exceptionSet);
|
out.exceptionFilters = Array.from(exceptionSet);
|
||||||
for ( const exception of exceptionSet ) {
|
for ( const selector of specificSet ) {
|
||||||
if (
|
if ( exceptionSet.has(selector) === false ) { continue; }
|
||||||
specificSet.delete(exception) ||
|
specificSet.delete(selector);
|
||||||
proceduralSet.delete(exception)
|
out.exceptedFilters.push(selector);
|
||||||
) {
|
|
||||||
out.exceptedFilters.push(exception);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -857,11 +854,18 @@ FilterContainer.prototype.retrieveSpecificSelectors = function(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Some procedural filters are really declarative cosmetic filters, so
|
// Apply exceptions to procedural filterset.
|
||||||
// we extract and inject them immediately.
|
// Also, some procedural filters are really declarative cosmetic
|
||||||
|
// filters, so we extract and inject them immediately.
|
||||||
if ( proceduralSet.size !== 0 ) {
|
if ( proceduralSet.size !== 0 ) {
|
||||||
for ( const json of proceduralSet ) {
|
for ( const json of proceduralSet ) {
|
||||||
const cssRule = this.cssRuleFromProcedural(json);
|
const pfilter = JSON.parse(json);
|
||||||
|
if ( exceptionSet.has(pfilter.raw) ) {
|
||||||
|
proceduralSet.delete(json);
|
||||||
|
out.exceptedFilters.push(pfilter.raw);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const cssRule = this.cssRuleFromProcedural(pfilter);
|
||||||
if ( cssRule === undefined ) { continue; }
|
if ( cssRule === undefined ) { continue; }
|
||||||
injectedCSS.push(cssRule);
|
injectedCSS.push(cssRule);
|
||||||
proceduralSet.delete(json);
|
proceduralSet.delete(json);
|
||||||
|
@ -2982,7 +2982,7 @@ class ExtSelectorCompiler {
|
|||||||
if ( hasArgs ) {
|
if ( hasArgs ) {
|
||||||
const arg = this.astSerialize(part.args);
|
const arg = this.astSerialize(part.args);
|
||||||
if ( typeof arg !== 'string' ) { return; }
|
if ( typeof arg !== 'string' ) { return; }
|
||||||
out.push(`(${arg})`);
|
out.push(`(${arg.trim()})`);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -3101,7 +3101,7 @@ class ExtSelectorCompiler {
|
|||||||
}
|
}
|
||||||
if ( tasks.length === 0 && out.action === undefined ) {
|
if ( tasks.length === 0 && out.action === undefined ) {
|
||||||
if ( prelude.length === 0 ) { return; }
|
if ( prelude.length === 0 ) { return; }
|
||||||
return prelude.join('');
|
return prelude.join('').trim();
|
||||||
}
|
}
|
||||||
if ( prelude.length !== 0 ) {
|
if ( prelude.length !== 0 ) {
|
||||||
tasks.push(this.createSpathTask(prelude.join('')));
|
tasks.push(this.createSpathTask(prelude.join('')));
|
||||||
|
Loading…
Reference in New Issue
Block a user