mirror of
https://github.com/gorhill/uBlock.git
synced 2024-09-01 00:29:39 +02:00
elemhide
is (and has always been) really generichide
This commit is contained in:
parent
6062ec9b23
commit
de587335bd
@ -176,7 +176,7 @@ var filterDecompiler = (function() {
|
|||||||
10: 'other',
|
10: 'other',
|
||||||
11: 'popunder',
|
11: 'popunder',
|
||||||
12: 'document',
|
12: 'document',
|
||||||
13: 'elemhide',
|
13: 'generichide',
|
||||||
14: 'inline-script',
|
14: 'inline-script',
|
||||||
15: 'popup'
|
15: 'popup'
|
||||||
};
|
};
|
||||||
|
@ -334,16 +334,14 @@ PageStore.prototype.init = function(tabId) {
|
|||||||
this.noGenericCosmeticFiltering = µb.staticNetFilteringEngine.matchStringExactType(
|
this.noGenericCosmeticFiltering = µb.staticNetFilteringEngine.matchStringExactType(
|
||||||
this.createContextFromPage(),
|
this.createContextFromPage(),
|
||||||
tabContext.normalURL,
|
tabContext.normalURL,
|
||||||
'elemhide'
|
'generichide'
|
||||||
) === false;
|
) === false;
|
||||||
if ( µb.logger.isEnabled() && this.noGenericCosmeticFiltering ) {
|
if ( µb.logger.isEnabled() && this.noGenericCosmeticFiltering ) {
|
||||||
// https://github.com/gorhill/uBlock/issues/370
|
|
||||||
// Log using `cosmetic-filtering`, not `elemhide`.
|
|
||||||
µb.logger.writeOne(
|
µb.logger.writeOne(
|
||||||
tabId,
|
tabId,
|
||||||
'net',
|
'net',
|
||||||
µb.staticNetFilteringEngine.toResultString(true),
|
µb.staticNetFilteringEngine.toResultString(true),
|
||||||
'elemhide',
|
'generichide',
|
||||||
tabContext.rawURL,
|
tabContext.rawURL,
|
||||||
this.tabHostname,
|
this.tabHostname,
|
||||||
this.tabHostname
|
this.tabHostname
|
||||||
|
@ -68,7 +68,7 @@ var typeNameToTypeValue = {
|
|||||||
'other': 10 << 4,
|
'other': 10 << 4,
|
||||||
'popunder': 11 << 4,
|
'popunder': 11 << 4,
|
||||||
'main_frame': 12 << 4,
|
'main_frame': 12 << 4,
|
||||||
'elemhide': 13 << 4,
|
'generichide': 13 << 4,
|
||||||
'inline-script': 14 << 4,
|
'inline-script': 14 << 4,
|
||||||
'popup': 15 << 4
|
'popup': 15 << 4
|
||||||
};
|
};
|
||||||
@ -87,7 +87,7 @@ var typeValueToTypeName = {
|
|||||||
10: 'other',
|
10: 'other',
|
||||||
11: 'popunder',
|
11: 'popunder',
|
||||||
12: 'document',
|
12: 'document',
|
||||||
13: 'elemhide',
|
13: 'generichide',
|
||||||
14: 'inline-script',
|
14: 'inline-script',
|
||||||
15: 'popup'
|
15: 'popup'
|
||||||
};
|
};
|
||||||
@ -337,57 +337,42 @@ var hostnameMissTest = function(owner) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var hostnameHitSetTest = function(owner) {
|
var hostnameHitSetTest = function(owner) {
|
||||||
var dict = owner._hostnameDict;
|
var dict = owner._hostnameDict,
|
||||||
var needle = pageHostnameRegister;
|
needle = pageHostnameRegister,
|
||||||
var pos;
|
pos;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if ( dict.has(needle) ) {
|
if ( dict.has(needle) ) { return true; }
|
||||||
return true;
|
|
||||||
}
|
|
||||||
pos = needle.indexOf('.');
|
pos = needle.indexOf('.');
|
||||||
if ( pos === -1 ) {
|
if ( pos === -1 ) { break; }
|
||||||
break;
|
|
||||||
}
|
|
||||||
needle = needle.slice(pos + 1);
|
needle = needle.slice(pos + 1);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
var hostnameMissSetTest = function(owner) {
|
var hostnameMissSetTest = function(owner) {
|
||||||
var dict = owner._hostnameDict;
|
var dict = owner._hostnameDict,
|
||||||
var needle = pageHostnameRegister;
|
needle = pageHostnameRegister,
|
||||||
var pos;
|
pos;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if ( dict.has(needle) ) {
|
if ( dict.has(needle) ) { return false; }
|
||||||
return false;
|
|
||||||
}
|
|
||||||
pos = needle.indexOf('.');
|
pos = needle.indexOf('.');
|
||||||
if ( pos === -1 ) {
|
if ( pos === -1 ) { break; }
|
||||||
break;
|
|
||||||
}
|
|
||||||
needle = needle.slice(pos + 1);
|
needle = needle.slice(pos + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
var hostnameMixedSetTest = function(owner) {
|
var hostnameMixedSetTest = function(owner) {
|
||||||
var dict = owner._hostnameDict;
|
var dict = owner._hostnameDict,
|
||||||
var needle = pageHostnameRegister;
|
needle = pageHostnameRegister,
|
||||||
var hit = false;
|
hit = false,
|
||||||
var v, pos;
|
v, pos;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
v = dict.get(needle);
|
v = dict.get(needle);
|
||||||
if ( v === false ) {
|
if ( v === false ) { return false; }
|
||||||
return false;
|
if ( v === true ) { hit = true; }
|
||||||
}
|
|
||||||
if ( v === true ) {
|
|
||||||
hit = true;
|
|
||||||
}
|
|
||||||
pos = needle.indexOf('.');
|
pos = needle.indexOf('.');
|
||||||
if ( pos === -1 ) {
|
if ( pos === -1 ) { break; }
|
||||||
break;
|
|
||||||
}
|
|
||||||
needle = needle.slice(pos + 1);
|
needle = needle.slice(pos + 1);
|
||||||
}
|
}
|
||||||
return hit;
|
return hit;
|
||||||
@ -1180,7 +1165,8 @@ FilterParser.prototype.toNormalizedType = {
|
|||||||
'other': 'other',
|
'other': 'other',
|
||||||
'popunder': 'popunder',
|
'popunder': 'popunder',
|
||||||
'document': 'main_frame',
|
'document': 'main_frame',
|
||||||
'elemhide': 'elemhide',
|
'generichide': 'generichide',
|
||||||
|
'elemhide': 'generichide',
|
||||||
'inline-script': 'inline-script',
|
'inline-script': 'inline-script',
|
||||||
'popup': 'popup'
|
'popup': 'popup'
|
||||||
};
|
};
|
||||||
@ -1272,7 +1258,7 @@ FilterParser.prototype.parseOptions = function(s) {
|
|||||||
// adding support for the new keyword.
|
// adding support for the new keyword.
|
||||||
if ( opt === 'elemhide' || opt === 'generichide' ) {
|
if ( opt === 'elemhide' || opt === 'generichide' ) {
|
||||||
if ( this.action === AllowAction ) {
|
if ( this.action === AllowAction ) {
|
||||||
this.parseOptType('elemhide', false);
|
this.parseOptType('generichide', false);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
this.unsupported = true;
|
this.unsupported = true;
|
||||||
@ -2223,9 +2209,9 @@ FilterContainer.prototype.matchStringExactType = function(context, requestURL, r
|
|||||||
var key, bucket;
|
var key, bucket;
|
||||||
|
|
||||||
// https://github.com/gorhill/uBlock/issues/1477
|
// https://github.com/gorhill/uBlock/issues/1477
|
||||||
// Special case: blocking elemhide filter ALWAYS exists, it is implicit --
|
// Special case: blocking generichide filter ALWAYS exists, it is implicit --
|
||||||
// thus we always and only check for exception filters.
|
// thus we always and only check for exception filters.
|
||||||
if ( requestType === 'elemhide' ) {
|
if ( requestType === 'generichide' ) {
|
||||||
key = AllowAnyParty | type;
|
key = AllowAnyParty | type;
|
||||||
if (
|
if (
|
||||||
(bucket = categories.get(toHex(key))) &&
|
(bucket = categories.get(toHex(key))) &&
|
||||||
|
Loading…
Reference in New Issue
Block a user