mirror of https://github.com/gorhill/uBlock.git
this fixes #497
This commit is contained in:
parent
aab341dbd9
commit
57274ac726
|
@ -88,7 +88,7 @@ return {
|
||||||
|
|
||||||
// read-only
|
// read-only
|
||||||
systemSettings: {
|
systemSettings: {
|
||||||
compiledMagic: 'wcuwrlodqyee',
|
compiledMagic: 'emkzqkaljcfd',
|
||||||
selfieMagic: 'spqmeuaftfra'
|
selfieMagic: 'spqmeuaftfra'
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -353,6 +353,9 @@ var messager = vAPI.messaging.channel('contentscript-end.js');
|
||||||
|
|
||||||
var processHighHighGenerics = function() {
|
var processHighHighGenerics = function() {
|
||||||
processHighHighGenericsTimer = null;
|
processHighHighGenericsTimer = null;
|
||||||
|
if ( highGenerics.hideHigh === '' ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if ( injectedSelectors.hasOwnProperty('{{highHighGenerics}}') ) {
|
if ( injectedSelectors.hasOwnProperty('{{highHighGenerics}}') ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -532,7 +532,8 @@ FilterContainer.prototype.reset = function() {
|
||||||
|
|
||||||
// permanent
|
// permanent
|
||||||
// [class], [id]
|
// [class], [id]
|
||||||
this.lowGenericFilters = {};
|
this.lowGenericHide = {};
|
||||||
|
this.lowGenericDonthide = [];
|
||||||
|
|
||||||
// [alt="..."], [title="..."]
|
// [alt="..."], [title="..."]
|
||||||
this.highLowGenericHide = {};
|
this.highLowGenericHide = {};
|
||||||
|
@ -601,6 +602,19 @@ FilterContainer.prototype.compile = function(s, out) {
|
||||||
|
|
||||||
FilterContainer.prototype.compileGenericSelector = function(parsed, out) {
|
FilterContainer.prototype.compileGenericSelector = function(parsed, out) {
|
||||||
var selector = parsed.suffix;
|
var selector = parsed.suffix;
|
||||||
|
|
||||||
|
// https://github.com/gorhill/uBlock/issues/497
|
||||||
|
// All generic exception filters are put in the same bucket: they are
|
||||||
|
// expected to be very rare.
|
||||||
|
if ( parsed.unhide ) {
|
||||||
|
out.push(
|
||||||
|
'c\v' +
|
||||||
|
'g1\v' +
|
||||||
|
selector
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var type = selector.charAt(0);
|
var type = selector.charAt(0);
|
||||||
var matches;
|
var matches;
|
||||||
|
|
||||||
|
@ -743,13 +757,13 @@ FilterContainer.prototype.fromCompiledContent = function(text, lineBeg, skip) {
|
||||||
filter = fields[0] === 'lg' ?
|
filter = fields[0] === 'lg' ?
|
||||||
new FilterPlain(fields[2]) :
|
new FilterPlain(fields[2]) :
|
||||||
new FilterPlainMore(fields[2]);
|
new FilterPlainMore(fields[2]);
|
||||||
bucket = this.lowGenericFilters[fields[1]];
|
bucket = this.lowGenericHide[fields[1]];
|
||||||
if ( bucket === undefined ) {
|
if ( bucket === undefined ) {
|
||||||
this.lowGenericFilters[fields[1]] = filter;
|
this.lowGenericHide[fields[1]] = filter;
|
||||||
} else if ( bucket instanceof FilterBucket ) {
|
} else if ( bucket instanceof FilterBucket ) {
|
||||||
bucket.add(filter);
|
bucket.add(filter);
|
||||||
} else {
|
} else {
|
||||||
this.lowGenericFilters[fields[1]] = new FilterBucket(bucket, filter);
|
this.lowGenericHide[fields[1]] = new FilterBucket(bucket, filter);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -808,6 +822,12 @@ FilterContainer.prototype.fromCompiledContent = function(text, lineBeg, skip) {
|
||||||
this.highHighGenericDonthideCount += 1;
|
this.highHighGenericDonthideCount += 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://github.com/gorhill/uBlock/issues/497
|
||||||
|
// Generic exception filters: expected to be a rare occurrence.
|
||||||
|
if ( fields[0] === 'g1' ) {
|
||||||
|
this.lowGenericDonthide.push(fields[1]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return textEnd;
|
return textEnd;
|
||||||
};
|
};
|
||||||
|
@ -884,7 +904,8 @@ FilterContainer.prototype.toSelfie = function() {
|
||||||
duplicateCount: this.duplicateCount,
|
duplicateCount: this.duplicateCount,
|
||||||
hostnameSpecificFilters: selfieFromDict(this.hostnameFilters),
|
hostnameSpecificFilters: selfieFromDict(this.hostnameFilters),
|
||||||
entitySpecificFilters: this.entityFilters,
|
entitySpecificFilters: this.entityFilters,
|
||||||
lowGenericFilters: selfieFromDict(this.lowGenericFilters),
|
lowGenericHide: selfieFromDict(this.lowGenericHide),
|
||||||
|
lowGenericDonthide: this.lowGenericDonthide,
|
||||||
highLowGenericHide: this.highLowGenericHide,
|
highLowGenericHide: this.highLowGenericHide,
|
||||||
highLowGenericDonthide: this.highLowGenericDonthide,
|
highLowGenericDonthide: this.highLowGenericDonthide,
|
||||||
highLowGenericHideCount: this.highLowGenericHideCount,
|
highLowGenericHideCount: this.highLowGenericHideCount,
|
||||||
|
@ -949,7 +970,8 @@ FilterContainer.prototype.fromSelfie = function(selfie) {
|
||||||
this.duplicateCount = selfie.duplicateCount;
|
this.duplicateCount = selfie.duplicateCount;
|
||||||
this.hostnameFilters = dictFromSelfie(selfie.hostnameSpecificFilters);
|
this.hostnameFilters = dictFromSelfie(selfie.hostnameSpecificFilters);
|
||||||
this.entityFilters = selfie.entitySpecificFilters;
|
this.entityFilters = selfie.entitySpecificFilters;
|
||||||
this.lowGenericFilters = dictFromSelfie(selfie.lowGenericFilters);
|
this.lowGenericHide = dictFromSelfie(selfie.lowGenericHide);
|
||||||
|
this.lowGenericDonthide = selfie.lowGenericDonthide;
|
||||||
this.highLowGenericHide = selfie.highLowGenericHide;
|
this.highLowGenericHide = selfie.highLowGenericHide;
|
||||||
this.highLowGenericDonthide = selfie.highLowGenericDonthide;
|
this.highLowGenericDonthide = selfie.highLowGenericDonthide;
|
||||||
this.highLowGenericHideCount = selfie.highLowGenericHideCount;
|
this.highLowGenericHideCount = selfie.highLowGenericHideCount;
|
||||||
|
@ -1078,7 +1100,8 @@ FilterContainer.prototype.retrieveGenericSelectors = function(request) {
|
||||||
|
|
||||||
var r = {
|
var r = {
|
||||||
hide: [],
|
hide: [],
|
||||||
donthide: []
|
// https://github.com/gorhill/uBlock/issues/497
|
||||||
|
donthide: this.lowGenericDonthide
|
||||||
};
|
};
|
||||||
|
|
||||||
if ( request.highGenerics ) {
|
if ( request.highGenerics ) {
|
||||||
|
@ -1110,7 +1133,7 @@ FilterContainer.prototype.retrieveGenericSelectors = function(request) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
hash = makeHash(0, selector, hashMask);
|
hash = makeHash(0, selector, hashMask);
|
||||||
if ( bucket = this.lowGenericFilters[hash] ) {
|
if ( bucket = this.lowGenericHide[hash] ) {
|
||||||
bucket.retrieve(selector, hideSelectors);
|
bucket.retrieve(selector, hideSelectors);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue