A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/gorhill/uBlock/commit/266ec4894b below:

New static network filter option `urlskip=` · gorhill/uBlock@266ec48 · GitHub

File tree Expand file treeCollapse file tree 6 files changed

+215

-127

lines changed

Filter options

Expand file treeCollapse file tree 6 files changed

+215

-127

lines changed Original file line number Diff line number Diff line change

@@ -163,6 +163,9 @@ export const FilteringContext = class {

163 163

this.stype = a;

164 164

}

165 165 166 +

isRootDocument() {

167 +

return (this.itype & MAIN_FRAME) !== 0;

168 +

}

166 169

isDocument() {

167 170

return (this.itype & FRAME_ANY) !== 0;

168 171

}

Original file line number Diff line number Diff line change

@@ -331,7 +331,7 @@ const processLoggerEntries = function(response) {

331 331

parsed.type === 'main_frame' &&

332 332

parsed.aliased === false && (

333 333

parsed.filter === undefined ||

334 -

parsed.filter.modifier !== true

334 +

parsed.filter.modifier !== true && parsed.filter.source !== 'redirect'

335 335

)

336 336

) {

337 337

const separator = createLogSeparator(parsed, unboxed.url);

Original file line number Diff line number Diff line change

@@ -933,26 +933,34 @@ const PageStore = class {

933 933

}

934 934 935 935

redirectNonBlockedRequest(fctxt) {

936 -

const transformDirectives = staticNetFilteringEngine.transformRequest(fctxt);

937 -

const pruneDirectives = fctxt.redirectURL === undefined &&

938 -

staticNetFilteringEngine.hasQuery(fctxt) &&

939 -

staticNetFilteringEngine.filterQuery(fctxt) ||

940 -

undefined;

941 -

if ( transformDirectives === undefined && pruneDirectives === undefined ) { return; }

942 -

if ( logger.enabled !== true ) { return; }

943 -

if ( transformDirectives !== undefined ) {

944 -

fctxt.pushFilters(transformDirectives.map(a => a.logData()));

945 -

}

946 -

if ( pruneDirectives !== undefined ) {

947 -

fctxt.pushFilters(pruneDirectives.map(a => a.logData()));

936 +

const directives = [];

937 +

staticNetFilteringEngine.transformRequest(fctxt, directives);

938 +

if ( staticNetFilteringEngine.hasQuery(fctxt) ) {

939 +

staticNetFilteringEngine.filterQuery(fctxt, directives);

948 940

}

941 +

if ( directives.length === 0 ) { return; }

942 +

if ( logger.enabled !== true ) { return; }

943 +

fctxt.pushFilters(directives.map(a => a.logData()));

949 944

if ( fctxt.redirectURL === undefined ) { return; }

950 945

fctxt.pushFilter({

951 946

source: 'redirect',

952 947

raw: fctxt.redirectURL

953 948

});

954 949

}

955 950 951 +

skipMainDocument(fctxt) {

952 +

const directives = staticNetFilteringEngine.urlSkip(fctxt);

953 +

if ( directives === undefined ) { return; }

954 +

if ( logger.enabled !== true ) { return; }

955 +

fctxt.pushFilters(directives.map(a => a.logData()));

956 +

if ( fctxt.redirectURL !== undefined ) {

957 +

fctxt.pushFilter({

958 +

source: 'redirect',

959 +

raw: fctxt.redirectURL

960 +

});

961 +

}

962 +

}

963 + 956 964

filterCSPReport(fctxt) {

957 965

if (

958 966

sessionSwitches.evaluateZ(

Original file line number Diff line number Diff line change

@@ -191,6 +191,7 @@ export const NODE_TYPE_NET_OPTION_NAME_REPLACE = iota++;

191 191

export const NODE_TYPE_NET_OPTION_NAME_SCRIPT = iota++;

192 192

export const NODE_TYPE_NET_OPTION_NAME_SHIDE = iota++;

193 193

export const NODE_TYPE_NET_OPTION_NAME_TO = iota++;

194 +

export const NODE_TYPE_NET_OPTION_NAME_URLSKIP = iota++;

194 195

export const NODE_TYPE_NET_OPTION_NAME_URLTRANSFORM = iota++;

195 196

export const NODE_TYPE_NET_OPTION_NAME_XHR = iota++;

196 197

export const NODE_TYPE_NET_OPTION_NAME_WEBRTC = iota++;

@@ -274,6 +275,7 @@ export const nodeTypeFromOptionName = new Map([

274 275

[ 'shide', NODE_TYPE_NET_OPTION_NAME_SHIDE ],

275 276

/* synonym */ [ 'specifichide', NODE_TYPE_NET_OPTION_NAME_SHIDE ],

276 277

[ 'to', NODE_TYPE_NET_OPTION_NAME_TO ],

278 +

[ 'urlskip', NODE_TYPE_NET_OPTION_NAME_URLSKIP ],

277 279

[ 'uritransform', NODE_TYPE_NET_OPTION_NAME_URLTRANSFORM ],

278 280

[ 'xhr', NODE_TYPE_NET_OPTION_NAME_XHR ],

279 281

/* synonym */ [ 'xmlhttprequest', NODE_TYPE_NET_OPTION_NAME_XHR ],

@@ -1441,6 +1443,7 @@ export class AstFilterParser {

1441 1443

case NODE_TYPE_NET_OPTION_NAME_REDIRECT:

1442 1444

case NODE_TYPE_NET_OPTION_NAME_REDIRECTRULE:

1443 1445

case NODE_TYPE_NET_OPTION_NAME_REPLACE:

1446 +

case NODE_TYPE_NET_OPTION_NAME_URLSKIP:

1444 1447

case NODE_TYPE_NET_OPTION_NAME_URLTRANSFORM:

1445 1448

realBad = isNegated || (isException || hasValue) === false ||

1446 1449

modifierType !== 0;

@@ -1519,6 +1522,21 @@ export class AstFilterParser {

1519 1522

}

1520 1523

break;

1521 1524

}

1525 +

case NODE_TYPE_NET_OPTION_NAME_URLSKIP: {

1526 +

realBad = abstractTypeCount || behaviorTypeCount || unredirectableTypeCount;

1527 +

if ( realBad ) { break; }

1528 +

if ( requiresTrustedSource() ) {

1529 +

this.astError = AST_ERROR_UNTRUSTED_SOURCE;

1530 +

realBad = true;

1531 +

break;

1532 +

}

1533 +

const value = this.getNetOptionValue(NODE_TYPE_NET_OPTION_NAME_URLSKIP);

1534 +

if ( value.startsWith('?') === false || value.length < 2 ) {

1535 +

this.astError = AST_ERROR_OPTION_BADVALUE;

1536 +

realBad = true;

1537 +

}

1538 +

break;

1539 +

}

1522 1540

case NODE_TYPE_NET_OPTION_NAME_URLTRANSFORM: {

1523 1541

realBad = abstractTypeCount || behaviorTypeCount || unredirectableTypeCount;

1524 1542

if ( realBad ) { break; }

@@ -3139,6 +3157,7 @@ export const netOptionTokenDescriptors = new Map([

3139 3157

[ 'shide', { } ],

3140 3158

/* synonym */ [ 'specifichide', { } ],

3141 3159

[ 'to', { mustAssign: true } ],

3160 +

[ 'urlskip', { mustAssign: true } ],

3142 3161

[ 'uritransform', { mustAssign: true } ],

3143 3162

[ 'xhr', { canNegate: true } ],

3144 3163

/* synonym */ [ 'xmlhttprequest', { canNegate: true } ],

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4