mirror of https://github.com/gorhill/uBlock.git
re #2294: mind unicode in "domain=" option + update URL of Adguard lists
This commit is contained in:
parent
7f4863fbcc
commit
2b1ab2234f
|
@ -20,6 +20,12 @@
|
||||||
"supportURL": "http://noads.it/"
|
"supportURL": "http://noads.it/"
|
||||||
},
|
},
|
||||||
"https://adguard.com/en/filter-rules.html?id=1": {
|
"https://adguard.com/en/filter-rules.html?id=1": {
|
||||||
|
"off": true,
|
||||||
|
"title": "RUS: Adguard Russian Filter (obsolete, will be removed)",
|
||||||
|
"group": "regions",
|
||||||
|
"supportURL": "http://forum.adguard.com/forumdisplay.php?69-%D0%A4%D0%B8%D0%BB%D1%8C%D1%82%D1%80%D1%8B-Adguard"
|
||||||
|
},
|
||||||
|
"https://filters.adtidy.org/extension/chromium/filters/1.txt": {
|
||||||
"off": true,
|
"off": true,
|
||||||
"title": "RUS: Adguard Russian Filter",
|
"title": "RUS: Adguard Russian Filter",
|
||||||
"group": "regions",
|
"group": "regions",
|
||||||
|
@ -328,6 +334,12 @@
|
||||||
"supportURL": "https://forums.lanik.us/"
|
"supportURL": "https://forums.lanik.us/"
|
||||||
},
|
},
|
||||||
"https://adguard.com/filter-rules.html?id=13": {
|
"https://adguard.com/filter-rules.html?id=13": {
|
||||||
|
"off": true,
|
||||||
|
"title": "TUR: Adguard Turkish Filter (obsolete, will be removed)",
|
||||||
|
"group": "regions",
|
||||||
|
"supportURL": "http://forum.adguard.com/forumdisplay.php?51-Filter-Rules"
|
||||||
|
},
|
||||||
|
"http://filters.adtidy.org/extension/chromium/filters/13.txt": {
|
||||||
"off": true,
|
"off": true,
|
||||||
"title": "TUR: Adguard Turkish Filter",
|
"title": "TUR: Adguard Turkish Filter",
|
||||||
"group": "regions",
|
"group": "regions",
|
||||||
|
|
|
@ -1211,7 +1211,7 @@ FilterParser.prototype.bitFromType = function(type) {
|
||||||
// https://github.com/chrisaljoudi/uBlock/issues/589
|
// https://github.com/chrisaljoudi/uBlock/issues/589
|
||||||
// Be ready to handle multiple negated types
|
// Be ready to handle multiple negated types
|
||||||
|
|
||||||
FilterParser.prototype.parseOptType = function(raw, not) {
|
FilterParser.prototype.parseTypeOption = function(raw, not) {
|
||||||
var typeBit = this.bitFromType(this.toNormalizedType[raw]);
|
var typeBit = this.bitFromType(this.toNormalizedType[raw]);
|
||||||
|
|
||||||
if ( !not ) {
|
if ( !not ) {
|
||||||
|
@ -1231,7 +1231,7 @@ FilterParser.prototype.parseOptType = function(raw, not) {
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
FilterParser.prototype.parseOptParty = function(firstParty, not) {
|
FilterParser.prototype.parsePartyOption = function(firstParty, not) {
|
||||||
if ( firstParty ) {
|
if ( firstParty ) {
|
||||||
not = !not;
|
not = !not;
|
||||||
}
|
}
|
||||||
|
@ -1244,6 +1244,23 @@ FilterParser.prototype.parseOptParty = function(firstParty, not) {
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
|
FilterParser.prototype.parseDomainOption = function(s) {
|
||||||
|
if ( this.reHasUnicode.test(s) ) {
|
||||||
|
var hostnames = s.split('|'),
|
||||||
|
i = hostnames.length;
|
||||||
|
while ( i-- ) {
|
||||||
|
hostnames[i] = punycode.toASCII(hostnames[i]);
|
||||||
|
}
|
||||||
|
s = hostnames.join('|');
|
||||||
|
}
|
||||||
|
if ( this.reBadDomainOptChars.test(s) ) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
return s;
|
||||||
|
};
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
FilterParser.prototype.parseOptions = function(s) {
|
FilterParser.prototype.parseOptions = function(s) {
|
||||||
this.fopts = s;
|
this.fopts = s;
|
||||||
var opts = s.split(',');
|
var opts = s.split(',');
|
||||||
|
@ -1255,7 +1272,7 @@ FilterParser.prototype.parseOptions = function(s) {
|
||||||
opt = opt.slice(1);
|
opt = opt.slice(1);
|
||||||
}
|
}
|
||||||
if ( opt === 'third-party' ) {
|
if ( opt === 'third-party' ) {
|
||||||
this.parseOptParty(false, not);
|
this.parsePartyOption(false, not);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// https://issues.adblockplus.org/ticket/616
|
// https://issues.adblockplus.org/ticket/616
|
||||||
|
@ -1263,7 +1280,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 ( not === false ) {
|
if ( not === false ) {
|
||||||
this.parseOptType('generichide', false);
|
this.parseTypeOption('generichide', false);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
this.unsupported = true;
|
this.unsupported = true;
|
||||||
|
@ -1271,18 +1288,18 @@ FilterParser.prototype.parseOptions = function(s) {
|
||||||
}
|
}
|
||||||
if ( opt === 'document' ) {
|
if ( opt === 'document' ) {
|
||||||
if ( this.action === BlockAction ) {
|
if ( this.action === BlockAction ) {
|
||||||
this.parseOptType('document', not);
|
this.parseTypeOption('document', not);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
this.unsupported = true;
|
this.unsupported = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ( this.toNormalizedType.hasOwnProperty(opt) ) {
|
if ( this.toNormalizedType.hasOwnProperty(opt) ) {
|
||||||
this.parseOptType(opt, not);
|
this.parseTypeOption(opt, not);
|
||||||
// Due to ABP categorizing `websocket` requests as `other`, we need
|
// Due to ABP categorizing `websocket` requests as `other`, we need
|
||||||
// to add `websocket` for when `other` is used.
|
// to add `websocket` for when `other` is used.
|
||||||
if ( opt === 'other' ) {
|
if ( opt === 'other' ) {
|
||||||
this.parseOptType('websocket', not);
|
this.parseTypeOption('websocket', not);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1290,8 +1307,8 @@ FilterParser.prototype.parseOptions = function(s) {
|
||||||
// Detect and discard filter if domain option contains nonsensical
|
// Detect and discard filter if domain option contains nonsensical
|
||||||
// characters.
|
// characters.
|
||||||
if ( opt.startsWith('domain=') ) {
|
if ( opt.startsWith('domain=') ) {
|
||||||
this.domainOpt = opt.slice(7);
|
this.domainOpt = this.parseDomainOption(opt.slice(7));
|
||||||
if ( this.reBadDomainOptChars.test(this.domainOpt) ) {
|
if ( this.domainOpt === '' ) {
|
||||||
this.unsupported = true;
|
this.unsupported = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1302,7 +1319,7 @@ FilterParser.prototype.parseOptions = function(s) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ( opt === 'first-party' ) {
|
if ( opt === 'first-party' ) {
|
||||||
this.parseOptParty(true, not);
|
this.parsePartyOption(true, not);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ( opt.startsWith('redirect=') ) {
|
if ( opt.startsWith('redirect=') ) {
|
||||||
|
|
Loading…
Reference in New Issue