mirror of
https://github.com/gorhill/uBlock.git
synced 2026-03-11 09:04:36 +00:00
this completely fixes #490
This commit is contained in:
parent
afb07552f6
commit
fa4e3ca492
3 changed files with 22 additions and 8 deletions
|
|
@ -173,6 +173,7 @@ var filterDecompiler = (function() {
|
||||||
6: 'subdocument',
|
6: 'subdocument',
|
||||||
7: 'font',
|
7: 'font',
|
||||||
8: 'other',
|
8: 'other',
|
||||||
|
12: 'document',
|
||||||
13: 'elemhide',
|
13: 'elemhide',
|
||||||
14: 'inline-script',
|
14: 'inline-script',
|
||||||
15: 'popup'
|
15: 'popup'
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,7 @@ var typeNameToTypeValue = {
|
||||||
'sub_frame': 6 << 4,
|
'sub_frame': 6 << 4,
|
||||||
'font': 7 << 4,
|
'font': 7 << 4,
|
||||||
'other': 8 << 4,
|
'other': 8 << 4,
|
||||||
|
'main_frame': 12 << 4,
|
||||||
'cosmetic-filtering': 13 << 4,
|
'cosmetic-filtering': 13 << 4,
|
||||||
'inline-script': 14 << 4,
|
'inline-script': 14 << 4,
|
||||||
'popup': 15 << 4
|
'popup': 15 << 4
|
||||||
|
|
@ -76,9 +77,10 @@ var typeValueToTypeName = {
|
||||||
3: 'object',
|
3: 'object',
|
||||||
4: 'script',
|
4: 'script',
|
||||||
5: 'xmlhttprequest',
|
5: 'xmlhttprequest',
|
||||||
6: 'sub_frame',
|
6: 'subdocument',
|
||||||
7: 'font',
|
7: 'font',
|
||||||
8: 'other',
|
8: 'other',
|
||||||
|
12: 'document',
|
||||||
13: 'cosmetic-filtering',
|
13: 'cosmetic-filtering',
|
||||||
14: 'inline-script',
|
14: 'inline-script',
|
||||||
15: 'popup'
|
15: 'popup'
|
||||||
|
|
@ -1231,6 +1233,7 @@ FilterParser.prototype.toNormalizedType = {
|
||||||
'subdocument': 'sub_frame',
|
'subdocument': 'sub_frame',
|
||||||
'font': 'font',
|
'font': 'font',
|
||||||
'other': 'other',
|
'other': 'other',
|
||||||
|
'document': 'main_frame',
|
||||||
'elemhide': 'cosmetic-filtering',
|
'elemhide': 'cosmetic-filtering',
|
||||||
'inline-script': 'inline-script',
|
'inline-script': 'inline-script',
|
||||||
'popup': 'popup'
|
'popup': 'popup'
|
||||||
|
|
@ -1278,7 +1281,7 @@ FilterParser.prototype.parseOptType = function(raw, not) {
|
||||||
this.types = allNetRequestTypesBitmap;
|
this.types = allNetRequestTypesBitmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.types &= ~typeBit;
|
this.types &= ~typeBit & allNetRequestTypesBitmap;
|
||||||
};
|
};
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
@ -1334,6 +1337,14 @@ FilterParser.prototype.parseOptions = function(s) {
|
||||||
this.unsupported = true;
|
this.unsupported = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if ( opt === 'document' ) {
|
||||||
|
if ( this.action === BlockAction ) {
|
||||||
|
this.parseOptType('document', not);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
this.unsupported = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
if ( this.toNormalizedType.hasOwnProperty(opt) ) {
|
if ( this.toNormalizedType.hasOwnProperty(opt) ) {
|
||||||
this.parseOptType(opt, not);
|
this.parseOptType(opt, not);
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -1342,10 +1353,6 @@ FilterParser.prototype.parseOptions = function(s) {
|
||||||
this.parseOptHostnames(opt.slice(7));
|
this.parseOptHostnames(opt.slice(7));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ( opt === 'popup' ) {
|
|
||||||
this.parseOptType('popup', not);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if ( opt === 'important' ) {
|
if ( opt === 'important' ) {
|
||||||
this.important = Important;
|
this.important = Important;
|
||||||
continue;
|
continue;
|
||||||
|
|
|
||||||
|
|
@ -183,10 +183,16 @@ var onBeforeRootFrameRequest = function(details) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filtering
|
// Static filtering: We always need the long-form result here.
|
||||||
var snfe = µb.staticNetFilteringEngine;
|
var snfe = µb.staticNetFilteringEngine;
|
||||||
|
|
||||||
|
// Check for specific block
|
||||||
|
if ( result === '' && snfe.matchStringExactType(context, requestURL, 'main_frame') !== undefined ) {
|
||||||
|
result = snfe.toResultString(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for generic block
|
||||||
if ( result === '' && snfe.matchString(context) !== undefined ) {
|
if ( result === '' && snfe.matchString(context) !== undefined ) {
|
||||||
// We always need the long-form result here.
|
|
||||||
result = snfe.toResultString(true);
|
result = snfe.toResultString(true);
|
||||||
// https://github.com/chrisaljoudi/uBlock/issues/1128
|
// https://github.com/chrisaljoudi/uBlock/issues/1128
|
||||||
// Do not block if the match begins after the hostname, except when
|
// Do not block if the match begins after the hostname, except when
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue