mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-07 03:12:33 +01:00
further fix to #238
This commit is contained in:
parent
fdde1b0ab4
commit
27cfc3324e
@ -89,7 +89,7 @@ return {
|
|||||||
firstUpdateAfter: 5 * oneMinute,
|
firstUpdateAfter: 5 * oneMinute,
|
||||||
nextUpdateAfter: 7 * oneHour,
|
nextUpdateAfter: 7 * oneHour,
|
||||||
|
|
||||||
selfieMagic: 'egpatnmgdcuv',
|
selfieMagic: 'gcygyxptwycl',
|
||||||
selfieAfter: 7 * oneMinute,
|
selfieAfter: 7 * oneMinute,
|
||||||
|
|
||||||
pageStores: {},
|
pageStores: {},
|
||||||
|
@ -1222,7 +1222,7 @@ FilterParser.prototype.parse = function(s) {
|
|||||||
|
|
||||||
var FilterContainer = function() {
|
var FilterContainer = function() {
|
||||||
this.reAnyToken = /[%0-9a-z]+/g;
|
this.reAnyToken = /[%0-9a-z]+/g;
|
||||||
this.buckets = new Array(6);
|
this.buckets = new Array(4);
|
||||||
this.blockedAnyPartyHostnames = new µb.LiquidDict();
|
this.blockedAnyPartyHostnames = new µb.LiquidDict();
|
||||||
this.blocked3rdPartyHostnames = new µb.LiquidDict();
|
this.blocked3rdPartyHostnames = new µb.LiquidDict();
|
||||||
this.filterParser = new FilterParser();
|
this.filterParser = new FilterParser();
|
||||||
@ -1494,13 +1494,7 @@ FilterContainer.prototype.addFilter = function(parsed) {
|
|||||||
if ( !filter ) {
|
if ( !filter ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
this.addFilterEntry(
|
this.addFilterEntry(filter, parsed, AnyParty, tokenBeg, tokenEnd);
|
||||||
filter,
|
|
||||||
parsed,
|
|
||||||
SpecificParty,
|
|
||||||
tokenBeg,
|
|
||||||
tokenEnd
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1528,13 +1522,7 @@ FilterContainer.prototype.addFilter = function(parsed) {
|
|||||||
if ( parsed.action === BlockAction ) {
|
if ( parsed.action === BlockAction ) {
|
||||||
parsed.important = Important;
|
parsed.important = Important;
|
||||||
}
|
}
|
||||||
this.addFilterEntry(
|
this.addFilterEntry(filter, parsed, AnyParty, tokenBeg, tokenEnd);
|
||||||
filter,
|
|
||||||
parsed,
|
|
||||||
SpecificParty,
|
|
||||||
tokenBeg,
|
|
||||||
tokenEnd
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1601,8 +1589,6 @@ FilterContainer.prototype.matchTokens = function(url) {
|
|||||||
var bucket1 = buckets[1];
|
var bucket1 = buckets[1];
|
||||||
var bucket2 = buckets[2];
|
var bucket2 = buckets[2];
|
||||||
var bucket3 = buckets[3];
|
var bucket3 = buckets[3];
|
||||||
var bucket4 = buckets[4];
|
|
||||||
var bucket5 = buckets[5];
|
|
||||||
|
|
||||||
re.lastIndex = 0;
|
re.lastIndex = 0;
|
||||||
while ( matches = re.exec(url) ) {
|
while ( matches = re.exec(url) ) {
|
||||||
@ -1632,18 +1618,6 @@ FilterContainer.prototype.matchTokens = function(url) {
|
|||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( bucket4 !== undefined && bucket4.hasOwnProperty(token) ) {
|
|
||||||
f = bucket4[token];
|
|
||||||
if ( f.match(url, beg) !== false ) {
|
|
||||||
return f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( bucket5 !== undefined && bucket5.hasOwnProperty(token) ) {
|
|
||||||
f = bucket5[token];
|
|
||||||
if ( f.match(url, beg) !== false ) {
|
|
||||||
return f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
@ -1714,13 +1688,12 @@ FilterContainer.prototype.matchStringExactType = function(pageDetails, requestUR
|
|||||||
// This will be used by hostname-based filters
|
// This will be used by hostname-based filters
|
||||||
pageHostname = pageDetails.pageHostname || '';
|
pageHostname = pageDetails.pageHostname || '';
|
||||||
|
|
||||||
buckets[0] = buckets[1] = buckets[2] = undefined;
|
buckets[0] = buckets[1] = undefined;
|
||||||
|
|
||||||
// https://github.com/gorhill/uBlock/issues/139
|
// https://github.com/gorhill/uBlock/issues/139
|
||||||
// Test against important block filters
|
// Test against important block filters
|
||||||
buckets[3] = categories[this.makeCategoryKey(BlockAnyParty | Important | type)];
|
buckets[2] = categories[this.makeCategoryKey(BlockAnyParty | Important | type)];
|
||||||
buckets[4] = categories[this.makeCategoryKey(BlockAction | Important | type | party)];
|
buckets[3] = categories[this.makeCategoryKey(BlockAction | Important | type | party)];
|
||||||
buckets[5] = categories[this.makeCategoryKey(BlockOneParty | Important | type)];
|
|
||||||
var bf = this.matchTokens(url);
|
var bf = this.matchTokens(url);
|
||||||
if ( bf !== false ) {
|
if ( bf !== false ) {
|
||||||
return bf.toString();
|
return bf.toString();
|
||||||
@ -1728,18 +1701,16 @@ FilterContainer.prototype.matchStringExactType = function(pageDetails, requestUR
|
|||||||
|
|
||||||
// Test against block filters
|
// Test against block filters
|
||||||
// If there is no block filter, no need to test against allow filters
|
// If there is no block filter, no need to test against allow filters
|
||||||
buckets[3] = categories[this.makeCategoryKey(BlockAnyParty | type)];
|
buckets[2] = categories[this.makeCategoryKey(BlockAnyParty | type)];
|
||||||
buckets[4] = categories[this.makeCategoryKey(BlockAction | type | party)];
|
buckets[3] = categories[this.makeCategoryKey(BlockAction | type | party)];
|
||||||
buckets[5] = categories[this.makeCategoryKey(BlockOneParty | type)];
|
|
||||||
bf = this.matchTokens(url);
|
bf = this.matchTokens(url);
|
||||||
if ( bf === false ) {
|
if ( bf === false ) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test against allow filters
|
// Test against allow filters
|
||||||
buckets[3] = categories[this.makeCategoryKey(AllowAnyParty | type)];
|
buckets[2] = categories[this.makeCategoryKey(AllowAnyParty | type)];
|
||||||
buckets[4] = categories[this.makeCategoryKey(AllowAction | type | party)];
|
buckets[3] = categories[this.makeCategoryKey(AllowAction | type | party)];
|
||||||
buckets[5] = categories[this.makeCategoryKey(AllowOneParty | type)];
|
|
||||||
var af = this.matchTokens(url);
|
var af = this.matchTokens(url);
|
||||||
if ( af !== false ) {
|
if ( af !== false ) {
|
||||||
return '@@' + af.toString();
|
return '@@' + af.toString();
|
||||||
@ -1805,10 +1776,8 @@ FilterContainer.prototype.matchString = function(pageDetails, requestURL, reques
|
|||||||
// the `important` property it is "evaluate allow then evaluate block".
|
// the `important` property it is "evaluate allow then evaluate block".
|
||||||
buckets[0] = categories[this.makeCategoryKey(BlockAnyTypeAnyParty | Important)];
|
buckets[0] = categories[this.makeCategoryKey(BlockAnyTypeAnyParty | Important)];
|
||||||
buckets[1] = categories[this.makeCategoryKey(BlockAnyType | Important | party)];
|
buckets[1] = categories[this.makeCategoryKey(BlockAnyType | Important | party)];
|
||||||
buckets[2] = categories[this.makeCategoryKey(BlockAnyTypeOneParty | Important)];
|
buckets[2] = categories[this.makeCategoryKey(BlockAnyParty | Important | type)];
|
||||||
buckets[3] = categories[this.makeCategoryKey(BlockAnyParty | Important | type)];
|
buckets[3] = categories[this.makeCategoryKey(BlockAction | Important | type | party)];
|
||||||
buckets[4] = categories[this.makeCategoryKey(BlockAction | Important | type | party)];
|
|
||||||
buckets[5] = categories[this.makeCategoryKey(BlockOneParty | Important | type)];
|
|
||||||
var bf = this.matchTokens(url);
|
var bf = this.matchTokens(url);
|
||||||
if ( bf !== false ) {
|
if ( bf !== false ) {
|
||||||
return bf.toString() + '$important';
|
return bf.toString() + '$important';
|
||||||
@ -1824,10 +1793,8 @@ FilterContainer.prototype.matchString = function(pageDetails, requestURL, reques
|
|||||||
if ( bf === false ) {
|
if ( bf === false ) {
|
||||||
buckets[0] = categories[this.makeCategoryKey(BlockAnyTypeAnyParty)];
|
buckets[0] = categories[this.makeCategoryKey(BlockAnyTypeAnyParty)];
|
||||||
buckets[1] = categories[this.makeCategoryKey(BlockAnyType | party)];
|
buckets[1] = categories[this.makeCategoryKey(BlockAnyType | party)];
|
||||||
buckets[2] = categories[this.makeCategoryKey(BlockAnyTypeOneParty)];
|
buckets[2] = categories[this.makeCategoryKey(BlockAnyParty | type)];
|
||||||
buckets[3] = categories[this.makeCategoryKey(BlockAnyParty | type)];
|
buckets[3] = categories[this.makeCategoryKey(BlockAction | type | party)];
|
||||||
buckets[4] = categories[this.makeCategoryKey(BlockAction | type | party)];
|
|
||||||
buckets[5] = categories[this.makeCategoryKey(BlockOneParty | type)];
|
|
||||||
bf = this.matchTokens(url);
|
bf = this.matchTokens(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1839,10 +1806,8 @@ FilterContainer.prototype.matchString = function(pageDetails, requestURL, reques
|
|||||||
// Test against allow filters
|
// Test against allow filters
|
||||||
buckets[0] = categories[this.makeCategoryKey(AllowAnyTypeAnyParty)];
|
buckets[0] = categories[this.makeCategoryKey(AllowAnyTypeAnyParty)];
|
||||||
buckets[1] = categories[this.makeCategoryKey(AllowAnyType | party)];
|
buckets[1] = categories[this.makeCategoryKey(AllowAnyType | party)];
|
||||||
buckets[2] = categories[this.makeCategoryKey(AllowAnyTypeOneParty)];
|
buckets[2] = categories[this.makeCategoryKey(AllowAnyParty | type)];
|
||||||
buckets[3] = categories[this.makeCategoryKey(AllowAnyParty | type)];
|
buckets[3] = categories[this.makeCategoryKey(AllowAction | type | party)];
|
||||||
buckets[4] = categories[this.makeCategoryKey(AllowAction | type | party)];
|
|
||||||
buckets[5] = categories[this.makeCategoryKey(AllowOneParty | type)];
|
|
||||||
var af = this.matchTokens(url);
|
var af = this.matchTokens(url);
|
||||||
if ( af !== false ) {
|
if ( af !== false ) {
|
||||||
return '@@' + af.toString();
|
return '@@' + af.toString();
|
||||||
|
Loading…
Reference in New Issue
Block a user