Skip to content

Commit 74905aa

Browse files
committed
1 parent 2ac643b commit 74905aa

4 files changed

Lines changed: 28 additions & 37 deletions

File tree

src/js/background.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ return {
9393

9494
// read-only
9595
systemSettings: {
96-
compiledMagic: 'ythmhjvufkkq',
96+
compiledMagic: 'nytangedtvcz',
9797
selfieMagic: 'xtsldiywhvgc'
9898
},
9999

src/js/logger-ui.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -273,10 +273,6 @@ var filterDecompiler = (function() {
273273
var typeVal = bits >>> 4 & 0x0F;
274274
if ( typeVal ) {
275275
opts.push(typeValToTypeName[typeVal]);
276-
// Because of the way `elemhide` is implemented
277-
if ( typeVal === 13 ) {
278-
filter = '@@' + filter;
279-
}
280276
}
281277
if ( opts.length !== 0 ) {
282278
filter += '$' + opts.join(',');

src/js/pagestore.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -320,16 +320,16 @@ PageStore.prototype.init = function(tabId) {
320320
this.skipCosmeticFiltering = µb.staticNetFilteringEngine.matchStringExactType(
321321
this.createContextFromPage(),
322322
tabContext.normalURL,
323-
'cosmetic-filtering'
324-
);
323+
'elemhide'
324+
) === false;
325325
if ( this.skipCosmeticFiltering && µb.logger.isEnabled() ) {
326326
// https://github.com/gorhill/uBlock/issues/370
327327
// Log using `cosmetic-filtering`, not `elemhide`.
328328
µb.logger.writeOne(
329329
tabId,
330330
'net',
331331
µb.staticNetFilteringEngine.toResultString(true),
332-
'cosmetic-filtering',
332+
'elemhide',
333333
tabContext.rawURL,
334334
this.tabHostname,
335335
this.tabHostname

src/js/static-net-filtering.js

Lines changed: 24 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ var typeNameToTypeValue = {
6767
'other': 10 << 4,
6868
'popunder': 11 << 4,
6969
'main_frame': 12 << 4,
70-
'cosmetic-filtering': 13 << 4,
70+
'elemhide': 13 << 4,
7171
'inline-script': 14 << 4,
7272
'popup': 15 << 4
7373
};
@@ -86,7 +86,7 @@ var typeValueToTypeName = {
8686
10: 'other',
8787
11: 'popunder',
8888
12: 'document',
89-
13: 'cosmetic-filtering',
89+
13: 'elemhide',
9090
14: 'inline-script',
9191
15: 'popup'
9292
};
@@ -1316,7 +1316,7 @@ FilterParser.prototype.toNormalizedType = {
13161316
'other': 'other',
13171317
'popunder': 'popunder',
13181318
'document': 'main_frame',
1319-
'elemhide': 'cosmetic-filtering',
1319+
'elemhide': 'elemhide',
13201320
'inline-script': 'inline-script',
13211321
'popup': 'popup'
13221322
};
@@ -1359,11 +1359,13 @@ FilterParser.prototype.parseOptType = function(raw, not) {
13591359
}
13601360

13611361
// Negated type: set all valid network request type bits to 1
1362-
if ( this.types === 0 ) {
1363-
this.types = allNetRequestTypesBitmap;
1362+
if (
1363+
(typeBit & allNetRequestTypesBitmap) !== 0 &&
1364+
(this.types & allNetRequestTypesBitmap) === 0
1365+
) {
1366+
this.types |= allNetRequestTypesBitmap;
13641367
}
1365-
1366-
this.types &= ~typeBit & allNetRequestTypesBitmap;
1368+
this.types &= ~typeBit;
13671369
};
13681370

13691371
/******************************************************************************/
@@ -1401,7 +1403,6 @@ FilterParser.prototype.parseOptions = function(s) {
14011403
if ( opt === 'elemhide' || opt === 'generichide' ) {
14021404
if ( this.action === AllowAction ) {
14031405
this.parseOptType('elemhide', false);
1404-
this.action = BlockAction;
14051406
continue;
14061407
}
14071408
this.unsupported = true;
@@ -2321,6 +2322,21 @@ FilterContainer.prototype.matchStringExactType = function(context, requestURL, r
23212322
var categories = this.categories;
23222323
var key, bucket;
23232324

2325+
// https://github.com/gorhill/uBlock/issues/1477
2326+
// Special case: blocking elemhide filter ALWAYS exists, it is implicit --
2327+
// thus we always and only check for exception filters.
2328+
if ( requestType === 'elemhide' ) {
2329+
key = AllowAnyParty | type;
2330+
if (
2331+
(bucket = categories[toHex(key)]) &&
2332+
this.matchTokens(bucket, url)
2333+
) {
2334+
this.keyRegister = key;
2335+
return false;
2336+
}
2337+
return undefined;
2338+
}
2339+
23242340
// https://github.com/chrisaljoudi/uBlock/issues/139
23252341
// Test against important block filters
23262342
key = BlockAnyParty | Important | type;
@@ -2338,27 +2354,6 @@ FilterContainer.prototype.matchStringExactType = function(context, requestURL, r
23382354
}
23392355
}
23402356

2341-
// Test against block filters
2342-
key = BlockAnyParty | type;
2343-
if ( (bucket = categories[toHex(key)]) ) {
2344-
if ( this.matchTokens(bucket, url) ) {
2345-
this.keyRegister = key;
2346-
}
2347-
}
2348-
if ( this.fRegister === null ) {
2349-
key = BlockAction | type | party;
2350-
if ( (bucket = categories[toHex(key)]) ) {
2351-
if ( this.matchTokens(bucket, url) ) {
2352-
this.keyRegister = key;
2353-
}
2354-
}
2355-
}
2356-
2357-
// If there is no block filter, no need to test against allow filters
2358-
if ( this.fRegister === null ) {
2359-
return undefined;
2360-
}
2361-
23622357
// Test against allow filters
23632358
key = AllowAnyParty | type;
23642359
if ( (bucket = categories[toHex(key)]) ) {

0 commit comments

Comments
 (0)